[Pkg-javascript-commits] [leaflet-markercluster] 04/128: get non-animated spiderfying working.

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 542892d6e7662ce5e8040657b32298d7d08970ab
Author: danzel <danzel at localhost.geek.nz>
Date:   Thu Jan 30 09:58:19 2014 +1300

    get non-animated spiderfying working.
---
 src/MarkerCluster.Spiderfier.js |  7 +++++++
 src/MarkerClusterGroup.js       | 35 ++++++-----------------------------
 2 files changed, 13 insertions(+), 29 deletions(-)

diff --git a/src/MarkerCluster.Spiderfier.js b/src/MarkerCluster.Spiderfier.js
index ead03b4..e9c3bbd 100644
--- a/src/MarkerCluster.Spiderfier.js
+++ b/src/MarkerCluster.Spiderfier.js
@@ -92,6 +92,8 @@ L.MarkerCluster.include({
 			childMarkers = this.getAllChildMarkers(),
 			m, i;
 
+		group._spiderfying = true;
+
 		this.setOpacity(1);
 		for (i = childMarkers.length - 1; i >= 0; i--) {
 			m = childMarkers[i];
@@ -112,6 +114,7 @@ L.MarkerCluster.include({
 			}
 		}
 
+		group._spiderfying = false;
 		group._spiderfied = null;
 	}
 });
@@ -124,6 +127,8 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
 			fg = group._featureGroup,
 			i, m, leg, newPos;
 
+		group._spiderfying = true;
+
 		for (i = childMarkers.length - 1; i >= 0; i--) {
 			newPos = map.layerPointToLatLng(positions[i]);
 			m = childMarkers[i];
@@ -142,6 +147,8 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
 			m._spiderLeg = leg;
 		}
 		this.setOpacity(0.3);
+
+		group._spiderfying = false;
 		group.fire('spiderfied');
 	},
 
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 08696dd..90f63f0 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -523,37 +523,14 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 	},
 
 	_childMarkerMoved: function (e) {
+		if (!this._spiderfying) {
+			e.target._latlng = e.oldLatLng;
+			this.removeLayer(e.target);
 
-		e.target._latlng = e.oldLatLng;
-		this.removeLayer(e.target);
-
-		e.target._latlng = e.latlng;
-		this.addLayer(e.target);
-
-		return;
-		this._removeLayer(e.layer, true);
-
-		//?????
-		if (this._featureGroup.hasLayer(layer)) {
-			this._featureGroup.removeLayer(layer);
-			if (layer.setOpacity) {
-				layer.setOpacity(1);
-			}
-		}
-
-		e.layer._latlng = e.latlng;
-		this._addLayer(e.layer);
-
-		//Work out what is visible
-		var visibleLayer = this.getVisibleParent(e.layer);
-
-		if (this._currentShownBounds.contains(visibleLayer.getLatLng())) {
-			if (this.options.animateAddingMarkers) {
-				this._animationAddLayer(layer, visibleLayer);
-			} else {
-				this._animationAddLayerNonAnimated(layer, visibleLayer);
-			}
+			e.target._latlng = e.latlng;
+			this.addLayer(e.target);
 		}
+		return;
 	},
 
 	//Internal function for removing a marker from everything.

-- 
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