[Libreoffice-commits] online.git: loleaflet/src

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 21 09:22:09 UTC 2020


 loleaflet/src/map/handler/Map.TouchGesture.js |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 283e3951ce69d638a7cae870aecf362280b4acc2
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 Sep 21 11:21:50 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>
    (cherry picked from commit 091eca0ae421ca436ba95ea1e478909f2a18d0a7)
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/103047

diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index 895977228..689e9104f 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -515,6 +515,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);
@@ -537,7 +540,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
@@ -554,6 +557,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