[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; const storePresentationSettings = this.props.storePresentationSettings;
me.api.asc_registerCallback('asc_onPresentationSize', (width, height) => { 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) => { me.api.asc_registerCallback('asc_onSendThemeColorSchemes', (arr) => {

View file

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

View file

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

View file

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

View file

@ -52,6 +52,21 @@ const SettingsList = withTranslation()(props => {
props.onOptionClick(page) 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 ( return (
<View style={props.style} stackPages={true} routes={routes}> <View style={props.style} stackPages={true} routes={routes}>
<Page> <Page>
@ -71,7 +86,7 @@ const SettingsList = withTranslation()(props => {
<ListItem title={_t.textDownload} link="#"> <ListItem title={_t.textDownload} link="#">
<Icon slot="media" icon="icon-download"></Icon> <Icon slot="media" icon="icon-download"></Icon>
</ListItem> </ListItem>
<ListItem title={_t.textPrint}> <ListItem title={_t.textPrint} onClick={onPrint}>
<Icon slot="media" icon="icon-print"></Icon> <Icon slot="media" icon="icon-print"></Icon>
</ListItem> </ListItem>
<ListItem title={_t.textPresentationInfo} link="#" onClick={onoptionclick.bind(this, "/presentation-info/")}> <ListItem title={_t.textPresentationInfo} link="#" onClick={onoptionclick.bind(this, "/presentation-info/")}>