[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2' - loleaflet/src
Henry Castro (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 17 16:24:38 UTC 2020
loleaflet/src/map/handler/Map.TouchGesture.js | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
New commits:
commit 091eca0ae421ca436ba95ea1e478909f2a18d0a7
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Aug 14 09:43:08 2020 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Aug 17 18:24:20 2020 +0200
mobile: pre-condition if they are numbers
The hammer library sometimes or random when
consecutively pinch events, the center and scale
has infinity values
Change-Id: Ide6605bcbc0c7b4818fd27b7b44706fb8122d80a
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100744
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index 15bb932d4..27792560d 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -511,6 +511,9 @@ L.Map.TouchGesture = L.Handler.extend({
},
_onPinchStart: function (e) {
+ if (isNaN(e.center.x) || isNaN(e.center.y))
+ return;
+
this._pinchStartCenter = {x: e.center.x, y: e.center.y};
if (this._map._docLayer.isCursorVisible()) {
this._map._docLayer._cursorMarker.setOpacity(0);
@@ -533,7 +536,7 @@ L.Map.TouchGesture = L.Handler.extend({
},
_onPinch: function (e) {
- if (!this._pinchStartCenter)
+ if (!this._pinchStartCenter || isNaN(e.center.x) || isNaN(e.center.y))
return;
// we need to invert the offset or the map is moved in the opposite direction
@@ -550,6 +553,9 @@ L.Map.TouchGesture = L.Handler.extend({
},
_onPinchEnd: function () {
+ if (!this._pinchStartCenter)
+ return;
+
var oldZoom = this._map.getZoom(),
zoomDelta = this._zoom - oldZoom,
finalZoom = this._map._limitZoom(zoomDelta > 0 ? Math.ceil(this._zoom) : Math.floor(this._zoom));
More information about the Libreoffice-commits
mailing list