Merge pull request #1050 from ONLYOFFICE/fix/fix-bugs-on-mobiles
Fix/fix bugs on mobiles
This commit is contained in:
commit
eb5edfd2b5
|
@ -203,26 +203,21 @@ class SearchView extends Component {
|
||||||
|
|
||||||
onEditorTouchStart(e) {
|
onEditorTouchStart(e) {
|
||||||
this.startPoint = this.pointerPosition(e);
|
this.startPoint = this.pointerPosition(e);
|
||||||
// console.log(this.startPoint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onEditorTouchEnd(e) {
|
onEditorTouchEnd(e) {
|
||||||
const endPoint = this.pointerPosition(e);
|
const endPoint = this.pointerPosition(e);
|
||||||
// console.log(endPoint);
|
|
||||||
|
|
||||||
if (this.searchbar.enabled) {
|
if (this.searchbar.enabled) {
|
||||||
let distance;
|
let distance;
|
||||||
|
|
||||||
if(this.startPoint) {
|
if(this.startPoint) {
|
||||||
distance = (!!this.startPoint.x || !!this.startPoint.y) ? 0 :
|
distance = (this.startPoint.x === undefined || this.startPoint.y === undefined) ? 0 :
|
||||||
Math.sqrt((endPoint.x -= this.startPoint.x) * endPoint.x + (endPoint.y -= this.startPoint.y) * endPoint.y);
|
Math.sqrt((endPoint.x -= this.startPoint.x) * endPoint.x + (endPoint.y -= this.startPoint.y) * endPoint.y);
|
||||||
} else {
|
} else {
|
||||||
distance = 0;
|
distance = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// const distance = (this.startPoint === undefined || this.startPoint === undefined) ? 0 :
|
|
||||||
// Math.sqrt((endPoint.x -= this.startPoint.x) * endPoint.x + (endPoint.y -= this.startPoint.y) * endPoint.y);
|
|
||||||
|
|
||||||
if (distance < 1) {
|
if (distance < 1) {
|
||||||
this.searchbar.disable();
|
this.searchbar.disable();
|
||||||
}
|
}
|
||||||
|
@ -231,15 +226,10 @@ class SearchView extends Component {
|
||||||
|
|
||||||
pointerPosition(e) {
|
pointerPosition(e) {
|
||||||
let out = {x:0, y:0};
|
let out = {x:0, y:0};
|
||||||
if ( e.type == 'touchstart' || e.type == 'touchend' ) {
|
if ( e.type == 'pointerdown' || e.type == 'pointerup' || e.type == 'mousedown' || e.type == 'mouseup') {
|
||||||
const touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
|
|
||||||
out.x = touch.pageX;
|
|
||||||
out.y = touch.pageY;
|
|
||||||
} else if ( e.type == 'mousedown' || e.type == 'mouseup' ) {
|
|
||||||
out.x = e.pageX;
|
out.x = e.pageX;
|
||||||
out.y = e.pageY;
|
out.y = e.pageY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 = () => {
|
||||||
|
|
|
@ -146,7 +146,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetIn
|
||||||
onRedo={onRedo}
|
onRedo={onRedo}
|
||||||
disabledControls={disabledControls}
|
disabledControls={disabledControls}
|
||||||
disabledEditControls={disabledEditControls || isObjectLocked || editFormulaMode || isEditCell}
|
disabledEditControls={disabledEditControls || isObjectLocked || editFormulaMode || isEditCell}
|
||||||
disabledSearch={editFormulaMode}
|
disabledSearch={editFormulaMode || isEditCell}
|
||||||
disabledSettings={disabledSettings || editFormulaMode || isEditCell}
|
disabledSettings={disabledSettings || editFormulaMode || isEditCell}
|
||||||
displayCollaboration={displayCollaboration}
|
displayCollaboration={displayCollaboration}
|
||||||
disabledCollaboration={editFormulaMode || isEditCell}
|
disabledCollaboration={editFormulaMode || isEditCell}
|
||||||
|
|
Loading…
Reference in a new issue