[Pkg-javascript-commits] [leaflet-markercluster] 08/128: Specifically ignore out setLatLng calls. Should fix using this with Leaflet.Label (which out don't setLatLng hack broke)

Jonas Smedegaard dr at jones.dk
Sun Apr 16 06:25:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository leaflet-markercluster.

commit 530ccaf1ab32dbd99b3529eb8244d0ed480b4b92
Author: danzel <danzel at localhost.geek.nz>
Date:   Thu Jan 30 13:35:15 2014 +1300

    Specifically ignore out setLatLng calls. Should fix using this with Leaflet.Label (which out don't setLatLng hack broke)
---
 src/MarkerCluster.Spiderfier.js | 16 ++++++++--------
 src/MarkerClusterGroup.js       |  8 +++++++-
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/MarkerCluster.Spiderfier.js b/src/MarkerCluster.Spiderfier.js
index f8d298f..8249ad0 100644
--- a/src/MarkerCluster.Spiderfier.js
+++ b/src/MarkerCluster.Spiderfier.js
@@ -92,7 +92,7 @@ L.MarkerCluster.include({
 			childMarkers = this.getAllChildMarkers(),
 			m, i;
 
-		group._spiderfying = true;
+		group._ignoreMove = true;
 
 		this.setOpacity(1);
 		for (i = childMarkers.length - 1; i >= 0; i--) {
@@ -114,7 +114,7 @@ L.MarkerCluster.include({
 			}
 		}
 
-		group._spiderfying = false;
+		group._ignoreMove = false;
 		group._spiderfied = null;
 	}
 });
@@ -127,7 +127,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
 			fg = group._featureGroup,
 			i, m, leg, newPos;
 
-		group._spiderfying = true;
+		group._ignoreMove = true;
 
 		for (i = childMarkers.length - 1; i >= 0; i--) {
 			newPos = map.layerPointToLatLng(positions[i]);
@@ -148,7 +148,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
 		}
 		this.setOpacity(0.3);
 
-		group._spiderfying = false;
+		group._ignoreMove = false;
 		group.fire('spiderfied');
 	},
 
@@ -170,7 +170,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
 			xmlns = 'http://www.w3.org/2000/svg',
 			i, m, leg, newPos;
 
-		group._spiderfying = true;
+		group._ignoreMove = true;
 
 		//Add markers to map hidden at our center point
 		for (i = childMarkers.length - 1; i >= 0; i--) {
@@ -258,7 +258,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
 			m._path.setAttribute('stroke-opacity', 0.5);
 		}
 
-		group._spiderfying = false;
+		group._ignoreMove = false;
 
 		setTimeout(function () {
 			group._animationEnd();
@@ -274,7 +274,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
 			childMarkers = this.getAllChildMarkers(),
 			m, i, a;
 
-		group._spiderfying = true;
+		group._ignoreMove = true;
 		group._animationStart();
 
 		//Make us visible and bring the child markers back in
@@ -315,7 +315,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
 			}
 		}
 
-		group._spiderfying = false;
+		group._ignoreMove = false;
 
 		setTimeout(function () {
 			//If we have only <= one child left then that marker will be shown on the map so don't remove it!
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index abd3271..6b6c13b 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -523,7 +523,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 	},
 
 	_childMarkerMoved: function (e) {
-		if (!this._spiderfying) {
+		if (!this._ignoreMove) {
 			e.target._latlng = e.oldLatLng;
 			this.removeLayer(e.target);
 
@@ -953,6 +953,8 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 		    fg = this._featureGroup,
 		    i;
 
+		this._ignoreMove = true;
+
 		//Add all children of current clusters to map and remove those clusters from map
 		this._topClusterLevel._recursively(bounds, previousZoomLevel, 0, function (c) {
 			var startPos = c._latlng,
@@ -999,6 +1001,8 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 			c._recursivelyRestoreChildPositions(newZoomLevel);
 		});
 
+		this._ignoreMove = false;
+
 		//Remove the old clusters and close the zoom animation
 		this._enqueue(function () {
 			//update the positions of the just added clusters/markers
@@ -1039,7 +1043,9 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 			if (cluster._childCount === 1) {
 				var m = cluster._markers[0];
 				//If we were in a cluster animation at the time then the opacity and position of our child could be wrong now, so fix it
+				this._ignoreMove = true;
 				m.setLatLng(m.getLatLng());
+				this._ignoreMove = false;
 				if (m.setOpacity) {
 					m.setOpacity(1);
 				}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet-markercluster.git



More information about the Pkg-javascript-commits mailing list