Skip to content

Commit 673f94f

Browse files
committed
fix(touch): stop zoom popping up onscreen keyboard
Previously, when you used pinch zoom on a mobile device, your onscreen keyboard would often pop up. This happened because some messages which you got during the zoom might normally trigger keyboard popup. Despite us ignoring these messages during the zoom, we would replay them after the zoom - popping up the keyboard when you released your fingers. To fix this, we need to record whether we're in a post zoom replay. If so, we should treat it as a situation where focusing the input should be done without triggering the keyboard. The rest of the code there is still important, so we can't avoid running these deferred messages or even cutting out as much of the code as we do when in the regular zoom state... Signed-off-by: Skyler Grey <skyler.grey@collabora.com> Change-Id: I5699457a439cbdd8a63f9f3e429be8286a6a6964
1 parent 4702339 commit 673f94f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

browser/src/canvas/CanvasSectionContainer.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ class CanvasSectionContainer {
188188
private scrollLineHeight: number = 30; // This will be overridden.
189189
private mouseIsInside: boolean = false;
190190
private inZoomAnimation: boolean = false;
191+
private postZoomReplay: boolean = false;
191192
private zoomChanged: boolean = false;
192193
private documentAnchorSectionName: string = null; // This section's top left point declares the point where document starts.
193194
private documentAnchor: Array<number> = null; // This is the point where document starts inside canvas element. Initial value shouldn't be [0, 0].
@@ -316,6 +317,14 @@ class CanvasSectionContainer {
316317
return this.inZoomAnimation;
317318
}
318319

320+
public setPostZoomReplay (postZoomReplay: boolean) {
321+
this.postZoomReplay = postZoomReplay;
322+
}
323+
324+
public isPostZoomReplay (): boolean {
325+
return this.postZoomReplay;
326+
}
327+
319328
public setZoomChanged (zoomChanged: boolean) {
320329
this.zoomChanged = zoomChanged;
321330
}

browser/src/layer/tile/CanvasTileLayer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2939,8 +2939,10 @@ window.L.CanvasTileLayer = window.L.Layer.extend({
29392939

29402940
_onZoomEnd: function () {
29412941
this._isZooming = false;
2942+
app.sectionContainer.setPostZoomReplay(true);
29422943
if (!this.isCalc())
29432944
this._replayPrintTwipsMsgs(false);
2945+
app.sectionContainer.setPostZoomReplay(false);
29442946
this._onUpdateCursor(null, true);
29452947
app.definitions.otherViewCursorSection.updateVisibilities();
29462948
},
@@ -3112,10 +3114,10 @@ window.L.CanvasTileLayer = window.L.Layer.extend({
31123114

31133115
var hasMobileWizardOpened = this._map.uiManager.mobileWizard ? this._map.uiManager.mobileWizard.isOpen() : false;
31143116
var hasIframeModalOpened = $('.iframe-dialog-modal').is(':visible');
3115-
// Don't show the keyboard when the Wizard is visible.
3117+
// Don't show the keyboard when the Wizard is visible, or when we have just been in a zoom
31163118
if (!window.mobileWizard && !window.pageMobileWizard &&
31173119
!window.insertionMobileWizard && !hasMobileWizardOpened &&
3118-
!JSDialog.IsAnyInputFocused() && !hasIframeModalOpened) {
3120+
!JSDialog.IsAnyInputFocused() && !hasIframeModalOpened && !app.sectionContainer.isPostZoomReplay()) {
31193121
// If the user is editing, show the keyboard, but don't change
31203122
// anything if nothing is changed.
31213123

0 commit comments

Comments
 (0)