[PE mobile] Edited Presentation Settings and added Print

This commit is contained in:
SergeyEzhin 2020-12-17 00:50:03 +03:00
parent ea7c1dbd45
commit 44532dc8bd
5 changed files with 33 additions and 27 deletions

View file

@ -169,7 +169,12 @@ class MainController extends Component {
const storePresentationSettings = this.props.storePresentationSettings;
me.api.asc_registerCallback('asc_onPresentationSize', (width, height) => {
storePresentationSettings.changeSlideSize(width, height);
const slideSizeArr = storePresentationSettings.getSlideSizes;
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) => {

View file

@ -8,7 +8,6 @@ class PresentationSettingsController extends Component {
onSlideSize(slideSizeArr) {
const api = Common.EditorApi.get();
// api.changeSlideSize(slideSizeArr[value][0], slideSizeArr[value][1]);
api.changeSlideSize(slideSizeArr[0], slideSizeArr[1]);
}
@ -21,7 +20,7 @@ class PresentationSettingsController extends Component {
onColorSchemeChange(newScheme) {
const api = Common.EditorApi.get();
api.asc_ChangeColorSchemeByIdx(+newScheme);
api.asc_ChangeColorSchemeByIdx(newScheme);
}

View file

@ -1,20 +1,15 @@
import {action, observable} from 'mobx';
export class storePresentationSettings {
@observable slideSize = [];
@observable slideSizeValue;
@observable slideSizeIndex;
get getSlideSizes() {
return [[254, 190.5], [254, 143]];
}
@action changeSlideSize(width, height) {
this.slideSize[0] = width;
this.slideSize[1] = height;
}
@action changeSlideFormat(value) {
this.slideSizeValue = +value;
@action changeSizeIndex(value) {
this.slideSizeIndex = +value;
}
// Color Schemes

View file

@ -8,9 +8,7 @@ const PagePresentationSettings = props => {
const _t = t("View.Settings", { returnObjects: true });
const store = props.storePresentationSettings;
const slideSizeArr = store.getSlideSizes;
const slideSize = store.slideSize;
const slideSizeValue = store.slideSizeValue;
console.log(slideSize);
const slideSizeIndex = store.slideSizeIndex;
return (
<Page>
@ -18,16 +16,10 @@ const PagePresentationSettings = props => {
<BlockTitle>{_t.textSlideSize}</BlockTitle>
<List>
<ListItem radio name="slide-size" value="0" checked={slideSizeValue === 0}
onChange={(e) => {
props.onSlideSize(slideSizeArr[e.target.value]);
store.changeSlideFormat(e.target.value);
}} title={_t.mniSlideStandard}></ListItem>
<ListItem radio name="slide-size" value="1" checked={slideSizeValue === 1}
onChange={(e) => {
props.onSlideSize(slideSizeArr[e.target.value]);
store.changeSlideFormat(e.target.value);
}} title={_t.mniSlideWide}></ListItem>
<ListItem radio name="slide-size" checked={slideSizeIndex === 0}
onChange={() => props.onSlideSize(slideSizeArr[0])} title={_t.mniSlideStandard}></ListItem>
<ListItem radio name="slide-size" checked={slideSizeIndex === 1}
onChange={() => props.onSlideSize(slideSizeArr[1])} title={_t.mniSlideWide}></ListItem>
</List>
<List mediaList>

View file

@ -52,6 +52,21 @@ const SettingsList = withTranslation()(props => {
props.onOptionClick(page)
};
const closeModal = () => {
if (Device.phone) {
f7.sheet.close('.settings-popup', true);
} else {
f7.popover.close('#settings-popover');
}
}
const onPrint = () => {
closeModal();
const api = Common.EditorApi.get();
api.asc_Print();
}
return (
<View style={props.style} stackPages={true} routes={routes}>
<Page>
@ -71,7 +86,7 @@ const SettingsList = withTranslation()(props => {
<ListItem title={_t.textDownload} link="#">
<Icon slot="media" icon="icon-download"></Icon>
</ListItem>
<ListItem title={_t.textPrint}>
<ListItem title={_t.textPrint} onClick={onPrint}>
<Icon slot="media" icon="icon-print"></Icon>
</ListItem>
<ListItem title={_t.textPresentationInfo} link="#" onClick={onoptionclick.bind(this, "/presentation-info/")}>