loleaflet/src/map/handler/Map.TouchGesture.js |  108 ++++++++++++--------------
 1 file changed, 51 insertions(+), 57 deletions(-)

New commits:
commit 0a8c8d7fc5c9f43cc56ee9bc98963b3d54c7d9e4
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Wed Nov 6 00:57:20 2019 +0000
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Wed Nov 6 00:57:20 2019 +0000

    Enable spreadsheet pinch to zoom.
    
    Change-Id: If8e4b87a78eeed6bb6a543d9acd532d5e096c540

diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js 
b/loleaflet/src/map/handler/Map.TouchGesture.js
index 1d3e15c45..84439db5b 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -441,79 +441,73 @@ L.Map.TouchGesture = L.Handler.extend({
        },
 
        _onPinchStart: function (e) {
-               if (this._map.getDocType() !== 'spreadsheet') {
-                       this._pinchStartCenter = {x: e.center.x, y: e.center.y};
-                       if (this._map._docLayer.isCursorVisible()) {
-                               this._map._docLayer._cursorMarker.setOpacity(0);
-                       }
-                       if (this._map._clipboardContainer._cursorHandler) {
-                               
this._map._clipboardContainer._cursorHandler.setOpacity(0);
-                       }
-                       if (this._map._docLayer._selectionHandles['start']) {
-                               
this._map._docLayer._selectionHandles['start'].setOpacity(0);
-                       }
-                       if (this._map._docLayer._selectionHandles['end']) {
-                               
this._map._docLayer._selectionHandles['end'].setOpacity(0);
-                       }
-
-                       
this._map._docLayer.eachView(this._map._docLayer._viewCursors, function (item) {
-                               var viewCursorMarker = item.marker;
-                               if (viewCursorMarker) {
-                                       viewCursorMarker.setOpacity(0);
-                               }
-                       }, this._map._docLayer, true);
+               this._pinchStartCenter = {x: e.center.x, y: e.center.y};
+               if (this._map._docLayer.isCursorVisible()) {
+                       this._map._docLayer._cursorMarker.setOpacity(0);
+               }
+               if (this._map._clipboardContainer._cursorHandler) {
+                       
this._map._clipboardContainer._cursorHandler.setOpacity(0);
                }
+               if (this._map._docLayer._selectionHandles['start']) {
+                       
this._map._docLayer._selectionHandles['start'].setOpacity(0);
+               }
+               if (this._map._docLayer._selectionHandles['end']) {
+                       
this._map._docLayer._selectionHandles['end'].setOpacity(0);
+               }
+               this._map._docLayer.eachView(this._map._docLayer._viewCursors, 
function (item) {
+                       var viewCursorMarker = item.marker;
+                       if (viewCursorMarker) {
+                               viewCursorMarker.setOpacity(0);
+                       }
+               }, this._map._docLayer, true);
        },
 
        _onPinch: function (e) {
                if (!this._pinchStartCenter)
                        return;
 
-               if (this._map.getDocType() !== 'spreadsheet') {
-                       // we need to invert the offset or the map is moved in 
the opposite direction
-                       var offset = {x: e.center.x - this._pinchStartCenter.x, 
y: e.center.y - this._pinchStartCenter.y};
-                       var center = {x: this._pinchStartCenter.x - offset.x, 
y: this._pinchStartCenter.y - offset.y};
-                       this._zoom = this._map.getScaleZoom(e.scale);
-                       this._center = 
this._map._limitCenter(this._map.mouseEventToLatLng({clientX: center.x, 
clientY: center.y}),
-                               this._zoom, this._map.options.maxBounds);
-
-                       L.Util.cancelAnimFrame(this._animRequest);
-                       this._animRequest = L.Util.requestAnimFrame(function () 
{
-                               this._map._animateZoom(this._center, 
this._zoom, false, true);
-                       }, this, true, this._map._container);
-               }
+               // we need to invert the offset or the map is moved in the 
opposite direction
+               var offset = {x: e.center.x - this._pinchStartCenter.x, y: 
e.center.y - this._pinchStartCenter.y};
+               var center = {x: this._pinchStartCenter.x - offset.x, y: 
this._pinchStartCenter.y - offset.y};
+               this._zoom = this._map.getScaleZoom(e.scale);
+               this._center = 
this._map._limitCenter(this._map.mouseEventToLatLng({clientX: center.x, 
clientY: center.y}),
+                                                     this._zoom, 
this._map.options.maxBounds);
+
+               L.Util.cancelAnimFrame(this._animRequest);
+               this._animRequest = L.Util.requestAnimFrame(function () {
+                       this._map._animateZoom(this._center, this._zoom, false, 
true);
+               }, this, true, this._map._container);
        },
 
        _onPinchEnd: function () {
-               if (this._map.getDocType() !== 'spreadsheet') {
-                       var oldZoom = this._map.getZoom(),
-                           zoomDelta = this._zoom - oldZoom,
-                           finalZoom = this._map._limitZoom(zoomDelta > 0 ? 
Math.ceil(this._zoom) : Math.floor(this._zoom));
+               var oldZoom = this._map.getZoom(),
+                   zoomDelta = this._zoom - oldZoom,
+                   finalZoom = this._map._limitZoom(zoomDelta > 0 ? 
Math.ceil(this._zoom) : Math.floor(this._zoom));
 
-                       if (this._map._docLayer.isCursorVisible()) {
-                               this._map._docLayer._cursorMarker.setOpacity(1);
-                       }
-                       if (this._map._clipboardContainer._cursorHandler) {
-                               
this._map._clipboardContainer._cursorHandler.setOpacity(1);
-                       }
-                       if (this._map._docLayer._selectionHandles['start']) {
-                               
this._map._docLayer._selectionHandles['start'].setOpacity(1);
-                       }
-                       if (this._map._docLayer._selectionHandles['end']) {
-                               
this._map._docLayer._selectionHandles['end'].setOpacity(1);
-                       }
+               if (this._map._docLayer.isCursorVisible()) {
+                       this._map._docLayer._cursorMarker.setOpacity(1);
+               }
+               if (this._map._clipboardContainer._cursorHandler) {
+                       
this._map._clipboardContainer._cursorHandler.setOpacity(1);
+               }
+               if (this._map._docLayer._selectionHandles['start']) {
+                       
this._map._docLayer._selectionHandles['start'].setOpacity(1);
+               }
+               if (this._map._docLayer._selectionHandles['end']) {
+                       
this._map._docLayer._selectionHandles['end'].setOpacity(1);
+               }
 
-                       if (this._center) {
-                               L.Util.cancelAnimFrame(this._animRequest);
-                               this._map._animateZoom(this._center, finalZoom, 
true, true);
-                       }
+               if (this._center) {
+                       L.Util.cancelAnimFrame(this._animRequest);
+                       this._map._animateZoom(this._center, finalZoom, true, 
true);
+               }
 
-                       if (this._map._docLayer && 
this._map._docLayer._annotations) {
-                               var annotations = 
this._map._docLayer._annotations;
+               if (this._map._docLayer && this._map._docLayer._annotations) {
+                       var annotations = this._map._docLayer._annotations;
+                       if (annotations.update)
                                setTimeout(function() {
                                        annotations.update();
                                }, 250 /* ms */);
-                       }
                }
        },
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to