[Pkg-javascript-commits] [leaflet-markercluster] 54/479: A few small bug fixes and code tidy ups. Add/Remove marker (after clustering) should be all that is broken now.

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:08 UTC 2014


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

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

commit d1b1df7cae0b69144143e04c9058af0f2fac3797
Author: danzel <danzel at localhost.geek.nz>
Date:   Fri Jul 20 09:15:02 2012 +1200

    A few small bug fixes and code tidy ups. Add/Remove marker (after clustering) should be all that is broken now.
---
 src/MarkerCluster.js      | 10 ++--------
 src/MarkerClusterGroup.js |  8 +++++---
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js
index 351de28..e84b14c 100644
--- a/src/MarkerCluster.js
+++ b/src/MarkerCluster.js
@@ -77,7 +77,7 @@ L.MarkerCluster = L.Marker.extend({
 	},
 
 	//Removes the given node from this marker cluster (or its child as required)
-	//Returns true if it (or its childCluster) removes the marker
+	//Returns true if it (or a child cluster) removes the marker
 	_recursivelyRemoveChildMarker: function(layer) {
 		var markers = this._markers,
 			childClusters = this._childClusters,
@@ -121,12 +121,6 @@ L.MarkerCluster = L.Marker.extend({
 		return false;
 	},
 
-	_recursivelyRemoveChildrenAndAddNowVisibleMarkers: function (bounds, depthToStartAt, depthToAnimateIn) {
-		this._recursively(bounds, depthToStartAt, 0, null, function (c) {
-			c._recursivelyRemoveChildrenFromMap(bounds, depthToAnimateIn - 1);
-		});
-	},
-
 	_recursivelyAnimateChildrenIn: function (bounds, center, depth) {
 		this._recursively(bounds, 0, depth - 1,
 			function (c) {
@@ -162,7 +156,7 @@ L.MarkerCluster = L.Marker.extend({
 				c._recursivelyAnimateChildrenIn(bounds, c._group._map.latLngToLayerPoint(c.getLatLng()).round(), depthToAnimateIn);
 
 				//TODO: depthToAnimateIn affects _isSingleParent, if there is a multizoom we may/may not be.
-				if (c._isSingleParent() /*&& depthToAnimateIn === 1*/) { //TODO: If we are the same as our parent, don't do an animation, just immediately appear
+				if (c._isSingleParent() && depthToAnimateIn === 1) { //TODO: If we are the same as our parent, don't do an animation, just immediately appear
 					c.setOpacity(1);
 					c._recursivelyRemoveChildrenFromMap(bounds, depthToAnimateIn - 1); //Immediately remove our children as we are replacing them. TODO previousBounds not bounds
 				} else {
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 49ab22d..41031a1 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -372,7 +372,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 				markers = c._markers,
 				m;
 
-			if (c._isSingleParent()) { //Immediately add the new child and remove us
+			if (c._isSingleParent() && depthToDescend == 1) { //Immediately add the new child and remove us
 				L.FeatureGroup.prototype.removeLayer.call(me, c);
 				c._recursivelyAddChildrenToMap(null, depthToDescend, bounds);
 			} else {
@@ -386,7 +386,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 			for (i = markers.length - 1; i >= 0; i--) {
 				m = markers[i];
 				if (!bounds.contains(m._latlng)) {
-					L.FeatureGroup.prototype.removeLayer.call(this, m);
+					L.FeatureGroup.prototype.removeLayer.call(me, m);
 				}
 			}
 
@@ -448,7 +448,9 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 		setTimeout(function () {
 
 			map._mapPane.className = map._mapPane.className.replace(' leaflet-cluster-anim', '');
-			me._topClusterLevel._recursivelyRemoveChildrenAndAddNowVisibleMarkers(bounds, depthToStartAt, depthToAnimateIn);
+			me._topClusterLevel._recursively(bounds, depthToStartAt, 0, null, function (c) {
+				c._recursivelyRemoveChildrenFromMap(bounds, depthToAnimateIn - 1);
+			});
 			me._inZoomAnimation--;
 		}, 250);
 	}

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