[Pkg-javascript-commits] [leaflet-markercluster] 48/479: _recursivelyAnimateChildrenIn -> _recursively

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 a7d784b105247f894f1afd13dc85a1eeeefdc12f
Author: danzel <danzel at localhost.geek.nz>
Date:   Thu Jul 19 12:03:34 2012 +1200

    _recursivelyAnimateChildrenIn -> _recursively
---
 src/MarkerCluster.js | 52 +++++++++++++++++++++++++---------------------------
 1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js
index ef193a8..a5037ac 100644
--- a/src/MarkerCluster.js
+++ b/src/MarkerCluster.js
@@ -148,41 +148,39 @@ L.MarkerCluster = L.Marker.extend({
 		}
 	},
 
-	_recursivelyAnimateChildrenIn: function (center, depth) {
-		var markers = this._markers,
-		    markersLength = markers.length,
-		    childClusters = this._childClusters,
-		    childClustersLength = childClusters.length;
-
-		for (var i = 0; i < markersLength; i++) {
-			var m = markers[i];
-
-			//Only do it if the icon is still on the map
-			if (m._icon) {
-				m._setPos(center);
-				m.setOpacity(0);
-			}
-		}
+	_recursivelyAnimateChildrenIn: function (bounds, center, depth) {
+		this._recursively(bounds, 0, depth - 1,
+			function (c) {
+				var markers = c._markers,
+					i, m;
+				for (i = markers.length - 1; i >= 0; i--) {
+					m = markers[i];
 
-		if (depth === 1) {
-			for (var j = 0; j < childClustersLength; j++) {
-				var cm = childClusters[j];
-				if (cm._icon) {
-					cm._setPos(center);
-					cm.setOpacity(0);
+					//Only do it if the icon is still on the map
+					if (m._icon) {
+						m._setPos(center);
+						m.setOpacity(0);
+					}
+				}
+			},
+			function (c) {
+				var childClusters = c._childClusters,
+					j, cm;
+				for (j = childClusters.length - 1; j >= 0; j--) {
+					cm = childClusters[j];
+					if (cm._icon) {
+						cm._setPos(center);
+						cm.setOpacity(0);
+					}
 				}
 			}
-		} else {
-			for (var k = 0; k < childClustersLength; k++) {
-				childClusters[k]._recursivelyAnimateChildrenIn(center, depth - 1);
-			}
-		}
+		);
 	},
 
 	_recursivelyAnimateChildrenInAndAddSelfToMap: function (bounds, depthToStartAt, depthToAnimateIn) {
 		this._recursively(bounds, depthToStartAt, 0,
 			function (c) {
-				c._recursivelyAnimateChildrenIn(c._group._map.latLngToLayerPoint(c.getLatLng()).round(), depthToAnimateIn);
+				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

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