[DE mobile] For Bug 58655
This commit is contained in:
parent
9f37a4c70d
commit
13cedf86f1
|
@ -3,7 +3,6 @@ import { inject, observer } from 'mobx-react';
|
||||||
import { f7 } from 'framework7-react';
|
import { f7 } from 'framework7-react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import ToolbarView from "../view/Toolbar";
|
import ToolbarView from "../view/Toolbar";
|
||||||
import {storeAppOptions} from "../store/appOptions";
|
|
||||||
import {LocalStorage} from "../../../../common/mobile/utils/LocalStorage";
|
import {LocalStorage} from "../../../../common/mobile/utils/LocalStorage";
|
||||||
|
|
||||||
const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'storeFocusObjects', 'storeToolbarSettings','storeDocumentInfo')(observer(props => {
|
const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'storeFocusObjects', 'storeToolbarSettings','storeDocumentInfo')(observer(props => {
|
||||||
|
@ -33,12 +32,23 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
|
||||||
const docExt = docInfo.dataDoc ? docInfo.dataDoc.fileType : '';
|
const docExt = docInfo.dataDoc ? docInfo.dataDoc.fileType : '';
|
||||||
const docTitle = docInfo.dataDoc ? docInfo.dataDoc.title : '';
|
const docTitle = docInfo.dataDoc ? docInfo.dataDoc.title : '';
|
||||||
|
|
||||||
|
const sensitivity = 20;
|
||||||
|
let touchStartY = 0;
|
||||||
|
let touchEndY = 0;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const sdk = document.querySelector('#editor_sdk');
|
||||||
|
|
||||||
Common.Gateway.on('init', loadConfig);
|
Common.Gateway.on('init', loadConfig);
|
||||||
Common.Notifications.on('toolbar:activatecontrols', activateControls);
|
Common.Notifications.on('toolbar:activatecontrols', activateControls);
|
||||||
Common.Notifications.on('toolbar:deactivateeditcontrols', deactivateEditControls);
|
Common.Notifications.on('toolbar:deactivateeditcontrols', deactivateEditControls);
|
||||||
Common.Notifications.on('goback', goBack);
|
Common.Notifications.on('goback', goBack);
|
||||||
|
|
||||||
|
if(isViewer) {
|
||||||
|
sdk.addEventListener('touchstart', handleTouchStart);
|
||||||
|
sdk.addEventListener('touchend', handleTouchEnd);
|
||||||
|
}
|
||||||
|
|
||||||
if (isDisconnected) {
|
if (isDisconnected) {
|
||||||
f7.popover.close();
|
f7.popover.close();
|
||||||
f7.sheet.close();
|
f7.sheet.close();
|
||||||
|
@ -49,9 +59,37 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
|
||||||
Common.Notifications.off('toolbar:activatecontrols', activateControls);
|
Common.Notifications.off('toolbar:activatecontrols', activateControls);
|
||||||
Common.Notifications.off('toolbar:deactivateeditcontrols', deactivateEditControls);
|
Common.Notifications.off('toolbar:deactivateeditcontrols', deactivateEditControls);
|
||||||
Common.Notifications.off('goback', goBack);
|
Common.Notifications.off('goback', goBack);
|
||||||
|
|
||||||
|
if(isViewer) {
|
||||||
|
sdk.removeEventListener('touchstart', handleTouchStart);
|
||||||
|
sdk.removeEventListener('touchend', handleTouchEnd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Touch handlers
|
||||||
|
|
||||||
|
const checkDirection = () => {
|
||||||
|
const diff = touchStartY - touchEndY;
|
||||||
|
|
||||||
|
if(Math.abs(diff) > sensitivity) {
|
||||||
|
if(diff > 0) {
|
||||||
|
// f7.navbar.show('.main-navbar');
|
||||||
|
} else {
|
||||||
|
// f7.navbar.hide('.main-navbar');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleTouchStart = e => {
|
||||||
|
touchStartY = e.changedTouches[0].screenY;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleTouchEnd = e => {
|
||||||
|
touchEndY = e.changedTouches[0].screenY;
|
||||||
|
checkDirection();
|
||||||
|
};
|
||||||
|
|
||||||
// Back button
|
// Back button
|
||||||
const [isShowBack, setShowBack] = useState(appOptions.canBackToFolder);
|
const [isShowBack, setShowBack] = useState(appOptions.canBackToFolder);
|
||||||
const loadConfig = (data) => {
|
const loadConfig = (data) => {
|
||||||
|
|
Loading…
Reference in a new issue