[PE mobile] Fix preview
This commit is contained in:
parent
d1c9c8525d
commit
ce3c2636d8
|
@ -11,8 +11,6 @@ const PreviewController = props => {
|
||||||
|
|
||||||
let _view, _touches, _touchStart, _touchEnd;
|
let _view, _touches, _touchStart, _touchEnd;
|
||||||
|
|
||||||
_view = $$('#pe-preview');
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onDocumentReady = () => {
|
const onDocumentReady = () => {
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
|
@ -25,10 +23,10 @@ const PreviewController = props => {
|
||||||
show();
|
show();
|
||||||
onDocumentReady();
|
onDocumentReady();
|
||||||
|
|
||||||
|
_view = $$('#pe-preview');
|
||||||
_view.on('touchstart', onTouchStart);
|
_view.on('touchstart', onTouchStart);
|
||||||
_view.on('touchmove', onTouchMove);
|
_view.on('touchmove', onTouchMove);
|
||||||
_view.on('touchend', onTouchEnd);
|
_view.on('touchend', onTouchEnd);
|
||||||
_view.on('click', onClick);
|
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
|
@ -38,7 +36,6 @@ const PreviewController = props => {
|
||||||
_view.off('touchstart', onTouchStart);
|
_view.off('touchstart', onTouchStart);
|
||||||
_view.off('touchmove', onTouchMove);
|
_view.off('touchmove', onTouchMove);
|
||||||
_view.off('touchend', onTouchEnd);
|
_view.off('touchend', onTouchEnd);
|
||||||
_view.off('click', onClick);
|
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
@ -82,15 +79,10 @@ const PreviewController = props => {
|
||||||
|
|
||||||
if (_touchEnd[0] - _touchStart[0] > 20)
|
if (_touchEnd[0] - _touchStart[0] > 20)
|
||||||
api.DemonstrationPrevSlide();
|
api.DemonstrationPrevSlide();
|
||||||
else if (_touchStart[0] - _touchEnd[0] > 20)
|
else if (_touchStart[0] - _touchEnd[0] > 20 || (Math.abs(_touchEnd[0] - _touchStart[0]) < 1 && Math.abs(_touchEnd[1] - _touchStart[1]) < 1))
|
||||||
api.DemonstrationNextSlide();
|
api.DemonstrationNextSlide();
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClick = e => {
|
|
||||||
const api = Common.EditorApi.get();
|
|
||||||
api.DemonstrationNextSlide();
|
|
||||||
};
|
|
||||||
|
|
||||||
// API Handlers
|
// API Handlers
|
||||||
|
|
||||||
const onEndDemonstration = () => {
|
const onEndDemonstration = () => {
|
||||||
|
|
Loading…
Reference in a new issue