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

Dennis Francis (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 3 07:33:28 UTC 2020


 loleaflet/src/layer/vector/Path.Transform.js |    8 ++++----
 loleaflet/src/layer/vector/Path.js           |   14 ++++++++++++++
 2 files changed, 18 insertions(+), 4 deletions(-)

New commits:
commit a66b6b98760aa291f8c2025f2b032c84a93b3279
Author:     Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Mon Aug 3 11:59:35 2020 +0530
Commit:     Dennis Francis <dennis.francis at collabora.com>
CommitDate: Mon Aug 3 09:33:09 2020 +0200

    fix direct access of DOM path node(s) of L.Path
    
    Since a59076e1ca88a6f2c8c67ce45bf769e963cf0717 there is no '_path'
    member in L.Path and the DOM node(s) of L.Path are managed by
    L.Path.PathNodeCollection.
    
    In this case, provide a public L.Path method to set its DOM node(s)
    cursor.
    
    Change-Id: I3b96fd38c1484b7b00a84697987c5522a9b2ce3d
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99982
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Dennis Francis <dennis.francis at collabora.com>

diff --git a/loleaflet/src/layer/vector/Path.Transform.js b/loleaflet/src/layer/vector/Path.Transform.js
index 270009346..86b48f4e5 100644
--- a/loleaflet/src/layer/vector/Path.Transform.js
+++ b/loleaflet/src/layer/vector/Path.Transform.js
@@ -12,10 +12,10 @@ L.PathTransform.Handle = L.CircleMarker.extend({
 
 	onAdd: function (map) {
 		L.CircleMarker.prototype.onAdd.call(this, map);
-		if (this._path && this.options.setCursor) { // SVG/VML
-			this._path.style.cursor = L.PathTransform.Handle.CursorsByType[
+		if (this.options.setCursor) { // SVG/VML
+			this.setCursorType(L.PathTransform.Handle.CursorsByType[
 				this.options.index
-			];
+			]);
 		}
 	}
 });
@@ -41,7 +41,7 @@ L.PathTransform.RotateHandle = L.PathTransform.Handle.extend({
 	onAdd: function (map) {
 		L.CircleMarker.prototype.onAdd.call(this, map);
 		if (this._path && this.options.setCursor) { // SVG/VML
-			this._path.style.cursor = 'all-scroll';
+			this.setCursorType('all-scroll');
 		}
 	}
 });
diff --git a/loleaflet/src/layer/vector/Path.js b/loleaflet/src/layer/vector/Path.js
index 17b777354..bcd405aa6 100644
--- a/loleaflet/src/layer/vector/Path.js
+++ b/loleaflet/src/layer/vector/Path.js
@@ -107,6 +107,10 @@ L.Path = L.Layer.extend({
 		this._pathNodeCollection.addOrRemoveClass(className, false /* add */);
 	},
 
+	setCursorType: function (cursorType) {
+		this._pathNodeCollection.setCursorType(cursorType);
+	},
+
 });
 
 L.Path.PathNodeData = L.Class.extend({
@@ -164,6 +168,10 @@ L.Path.PathNodeData = L.Class.extend({
 		}
 	},
 
+	setCursorType: function (cursorType) {
+		this._pathNode.style.cursor = cursorType;
+	},
+
 });
 
 L.Path.PathNodeData.key = function (layer) {
@@ -213,4 +221,10 @@ L.Path.PathNodeCollection = L.Class.extend({
 		});
 	},
 
+	setCursorType: function (cursorType) {
+		this.forEachNode(function (nodeData) {
+			nodeData.setCursorType(cursorType);
+		});
+	},
+
 });


More information about the Libreoffice-commits mailing list