[PE mobile] Fixed Presentation Settings according to mobx v. 6

This commit is contained in:
SergeyEzhin 2021-03-10 21:46:18 +03:00
parent 5d06b05a51
commit e47157f949
4 changed files with 29 additions and 17 deletions

View file

@ -36,12 +36,6 @@ class PESearchView extends SearchView {
onSearchbarShow(isshowed, bar) {
super.onSearchbarShow(isshowed, bar);
// const api = Common.EditorApi.get();
// if ( isshowed ) {
// const checkboxMarkResults = f7.toggle.get('.toggle-mark-results');
// api.asc_selectSearchingResults(checkboxMarkResults.checked);
// } else api.asc_selectSearchingResults(false);
}
}

View file

@ -7,12 +7,19 @@ class PresentationSettingsController extends Component {
super(props);
this.initSlideSize = this.initSlideSize.bind(this);
this.onSlideSize = this.onSlideSize.bind(this);
this.initSlideSize();
}
initSlideSize() {
if (!this.init) {
const api = Common.EditorApi.get();
const slideSizes = [
[9144000, 6858000, Asc.c_oAscSlideSZType.SzScreen4x3],
[12192000, 6858000, Asc.c_oAscSlideSZType.SzCustom]
];
this.props.storePresentationSettings.changeSizeIndex(api.get_PresentationWidth(), api.get_PresentationHeight());
this.props.storePresentationSettings.initSlideSizes(slideSizes);
this.init = true;
}
}

View file

@ -1,15 +1,23 @@
import {action, observable} from 'mobx';
import {action, observable, makeObservable} from 'mobx';
export class storePresentationSettings {
@observable slideSizes = [
[9144000, 6858000, Asc.c_oAscSlideSZType.SzScreen4x3],
[12192000, 6858000, Asc.c_oAscSlideSZType.SzCustom]
];
constructor() {
makeObservable(this, {
slideSizes: observable,
currentPageSize: observable,
slideSizeIndex: observable,
allSchemes: observable,
changeSizeIndex: action,
addSchemes: action,
initSlideSizes: action
})
}
@observable currentPageSize;
@observable slideSizeIndex;
slideSizes = [];
currentPageSize;
slideSizeIndex;
@action changeSizeIndex(width, height) {
changeSizeIndex(width, height) {
this.currentPageSize = {width, height};
let ratio = height / width;
@ -20,11 +28,15 @@ export class storePresentationSettings {
});
}
initSlideSizes(value) {
this.slideSizes = value;
}
// Color Schemes
@observable allSchemes;
allSchemes;
@action addSchemes(arr) {
addSchemes(arr) {
this.allSchemes = arr;
}

View file

@ -6,7 +6,6 @@ import { useTranslation } from "react-i18next";
const PagePresentationSettings = props => {
const { t } = useTranslation();
const _t = t("View.Settings", { returnObjects: true });
props.initSlideSize();
const storePresentationSettings = props.storePresentationSettings;
const slideSizeArr = storePresentationSettings.slideSizes;
const slideSizeIndex = storePresentationSettings.slideSizeIndex;