[PE mobile] Fixed slide size settings into presentation settings
This commit is contained in:
parent
44532dc8bd
commit
55f0865749
|
@ -169,12 +169,7 @@ class MainController extends Component {
|
||||||
const storePresentationSettings = this.props.storePresentationSettings;
|
const storePresentationSettings = this.props.storePresentationSettings;
|
||||||
|
|
||||||
me.api.asc_registerCallback('asc_onPresentationSize', (width, height) => {
|
me.api.asc_registerCallback('asc_onPresentationSize', (width, height) => {
|
||||||
const slideSizeArr = storePresentationSettings.getSlideSizes;
|
storePresentationSettings.changeSizeIndex(width, height);
|
||||||
slideSizeArr.forEach((array, index) => {
|
|
||||||
if(Math.abs(array[0] - width) < 0.001 && Math.abs((array[1] - height)) < 0.001) {
|
|
||||||
storePresentationSettings.changeSizeIndex(index);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
me.api.asc_registerCallback('asc_onSendThemeColorSchemes', (arr) => {
|
me.api.asc_registerCallback('asc_onSendThemeColorSchemes', (arr) => {
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
import React, {Component} from 'React';
|
import React, {Component} from 'React';
|
||||||
|
import { observer, inject } from "mobx-react";
|
||||||
import {PresentationSettings} from '../../view/settings/PresentationSettings';
|
import {PresentationSettings} from '../../view/settings/PresentationSettings';
|
||||||
|
|
||||||
class PresentationSettingsController extends Component {
|
class PresentationSettingsController extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
this.initSlideSize = this.initSlideSize.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
initSlideSize() {
|
||||||
|
if (!this.init) {
|
||||||
|
const api = Common.EditorApi.get();
|
||||||
|
this.props.storePresentationSettings.changeSizeIndex(api.get_PresentationWidth(), api.get_PresentationHeight());
|
||||||
|
this.init = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSlideSize(slideSizeArr) {
|
onSlideSize(slideSizeArr) {
|
||||||
|
@ -27,6 +37,7 @@ class PresentationSettingsController extends Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<PresentationSettings
|
<PresentationSettings
|
||||||
|
initSlideSize={this.initSlideSize}
|
||||||
onSlideSize={this.onSlideSize}
|
onSlideSize={this.onSlideSize}
|
||||||
onColorSchemeChange={this.onColorSchemeChange}
|
onColorSchemeChange={this.onColorSchemeChange}
|
||||||
initPageColorSchemes={this.initPageColorSchemes}
|
initPageColorSchemes={this.initPageColorSchemes}
|
||||||
|
@ -35,4 +46,4 @@ class PresentationSettingsController extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PresentationSettingsController;
|
export default inject("storePresentationSettings")(observer(PresentationSettingsController));
|
|
@ -1,15 +1,19 @@
|
||||||
import {action, observable} from 'mobx';
|
import {action, observable} from 'mobx';
|
||||||
|
|
||||||
export class storePresentationSettings {
|
export class storePresentationSettings {
|
||||||
|
slideSize = [[254, 190.5], [254, 143]];
|
||||||
@observable slideSizeIndex;
|
@observable slideSizeIndex;
|
||||||
|
|
||||||
get getSlideSizes() {
|
get getSlideSizes() {
|
||||||
return [[254, 190.5], [254, 143]];
|
return this.slideSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action changeSizeIndex(value) {
|
@action changeSizeIndex(width, height) {
|
||||||
this.slideSizeIndex = +value;
|
this.slideSize.forEach((array, index) => {
|
||||||
|
if(Math.abs(array[0] - width) < 0.001 && Math.abs((array[1] - height)) < 0.001) {
|
||||||
|
this.slideSizeIndex = index;
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Color Schemes
|
// Color Schemes
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { useTranslation } from "react-i18next";
|
||||||
const PagePresentationSettings = props => {
|
const PagePresentationSettings = props => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const _t = t("View.Settings", { returnObjects: true });
|
const _t = t("View.Settings", { returnObjects: true });
|
||||||
|
props.initSlideSize();
|
||||||
const store = props.storePresentationSettings;
|
const store = props.storePresentationSettings;
|
||||||
const slideSizeArr = store.getSlideSizes;
|
const slideSizeArr = store.getSlideSizes;
|
||||||
const slideSizeIndex = store.slideSizeIndex;
|
const slideSizeIndex = store.slideSizeIndex;
|
||||||
|
|
Loading…
Reference in a new issue