[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - loleaflet/plugins

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Apr 30 02:15:08 UTC 2019


 loleaflet/plugins/path-transform/src/Path.Transform.js |   26 +++++++++++++++--
 1 file changed, 23 insertions(+), 3 deletions(-)

New commits:
commit b51700b7b9498475932ebfda4159709e34752d61
Author:     Marco Cecchetti <mrcekets at gmail.com>
AuthorDate: Mon Mar 4 20:36:45 2019 +0100
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Tue Apr 30 04:14:50 2019 +0200

    leaflet: after resizing a shape, dragging cursor with mouse pans view
    
    The problem was in Path.Transform._apply executed at scale/rotate end
    which enabled map dragging unconditionally.
    
    Change-Id: Id42dc7de397a2ca2774f9d31a698c32b5e1c8514
    Reviewed-on: https://gerrit.libreoffice.org/70559
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Tested-by: Henry Castro <hcastro at collabora.com>

diff --git a/loleaflet/plugins/path-transform/src/Path.Transform.js b/loleaflet/plugins/path-transform/src/Path.Transform.js
index f7efd72cc..3ea9ddaab 100644
--- a/loleaflet/plugins/path-transform/src/Path.Transform.js
+++ b/loleaflet/plugins/path-transform/src/Path.Transform.js
@@ -282,6 +282,7 @@ L.Handler.PathTransform = L.Handler.extend({
 		var matrix = this._matrix.clone();
 		var angle = this._angle;
 		var scale = this._scale.clone();
+		var moved = this._handleDragged;
 
 		this._transformGeometries();
 
@@ -299,7 +300,11 @@ L.Handler.PathTransform = L.Handler.extend({
 
 		this._updateHandlers();
 
-		map.dragging.enable();
+		if (this._mapDraggingWasEnabled) {
+			if (moved) L.DomEvent._fakeStop({ type: 'click' });
+			map.dragging.enable();
+		}
+
 		this._path.fire('transformed', {
 			matrix: matrix,
 			scale: scale,
@@ -576,7 +581,12 @@ L.Handler.PathTransform = L.Handler.extend({
 	_onRotateStart: function(evt) {
 		var map = this._map;
 
-		map.dragging.disable();
+		this._handleDragged = false;
+		this._mapDraggingWasEnabled = false;
+		if (map.dragging.enabled()) {
+			map.dragging.disable();
+			this._mapDraggingWasEnabled = true;
+		}
 
 		this._originMarker     = null;
 		this._rotationOriginPt = map.latLngToLayerPoint(this._getRotationOrigin());
@@ -604,6 +614,8 @@ L.Handler.PathTransform = L.Handler.extend({
 		var previous = this._rotationStart;
 		var origin   = this._rotationOriginPt;
 
+		this._handleDragged = true;
+
 		// rotation step angle
 		this._angle = Math.atan2(pos.y - origin.y, pos.x - origin.x) -
 			Math.atan2(previous.y - origin.y, previous.x - origin.x);
@@ -649,7 +661,12 @@ L.Handler.PathTransform = L.Handler.extend({
 		var marker = evt.target;
 		var map = this._map;
 
-		map.dragging.disable();
+		this._handleDragged = false;
+		this._mapDraggingWasEnabled = false;
+		if (map.dragging.enabled()) {
+			map.dragging.disable();
+			this._mapDraggingWasEnabled = true;
+		}
 
 		this._activeMarker = marker;
 
@@ -688,6 +705,9 @@ L.Handler.PathTransform = L.Handler.extend({
 	_onScale: function(evt) {
 		var originPoint = this._originMarker._point;
 		var ratioX, ratioY;
+
+		this._handleDragged = true;
+
 		if (this.options.uniformScaling) {
 			ratioX = originPoint.distanceTo(evt.layerPoint) / this._initialDist;
 			ratioY = ratioX;


More information about the Libreoffice-commits mailing list