summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormert <mert.tumer@collabora.com>2020-09-16 17:31:46 +0300
committerAndras Timar <andras.timar@collabora.com>2020-09-21 17:20:06 +0200
commitc43aeb3e35a99c2f35bb817037d2451dc8731ae5 (patch)
tree684911e9189b846180f9400cbc6e50e7fa6602c5
parente9e6d981e3727eec013e259fc9170eaf69f94614 (diff)
Fix pinch gesture causes hammer to stuck on Mobile
Change-Id: If0ae311346a1111e9c9935ebacde3bc5ea874833 Signed-off-by: mert <mert.tumer@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102873 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--loleaflet/src/map/handler/Map.TouchGesture.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index 689e9104f..ce3ca184e 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -53,9 +53,20 @@ L.Map.TouchGesture = L.Handler.extend({
var tripleTap = new Hammer.Tap({event: 'tripletap', taps: 3, posThreshold: posThreshold });
this._hammer.add(tripleTap);
tripleTap.recognizeWith([doubleTap, singleTap]);
-
+ var hammer = this._hammer;
if (L.Browser.touch) {
- L.DomEvent.on(this._map._mapPane, 'touchstart touchmove touchend touchcancel', L.DomEvent.preventDefault);
+ L.DomEvent.on(this._map._mapPane, 'touchstart touchmove touchcancel', L.DomEvent.preventDefault);
+ L.DomEvent.on(this._map._mapPane, 'touchend', function(e) {
+ // sometimes inputs get stuck in hammer and further events get mixed with the old ones
+ // this causes to a failure to use all the gestures properly.
+ // This is a workaround until it is fixed by hammer.js
+ if (hammer.input) {
+ if (hammer.input.store) {
+ hammer.input.store = [];
+ }
+ }
+ L.DomEvent.preventDefault(e);
+ });
}
if (Hammer.prefixed(window, 'PointerEvent') !== undefined) {