From a1bab91ebda123279210ceca88c0873e2d2a6249 Mon Sep 17 00:00:00 2001 From: danzel Date: Thu, 19 Jul 2012 16:49:33 +1200 Subject: [PATCH] Fix _recursivelyRemoveChildrenAndAddNowVisibleMarkers --- src/MarkerCluster.js | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js index 24b6ad7e9..351de283c 100644 --- a/src/MarkerCluster.js +++ b/src/MarkerCluster.js @@ -122,30 +122,9 @@ L.MarkerCluster = L.Marker.extend({ }, _recursivelyRemoveChildrenAndAddNowVisibleMarkers: function (bounds, depthToStartAt, depthToAnimateIn) { - //TODO: Care more about bounds? - var childClusters = this._childClusters, - markers = this._markers, - i; - - if (depthToStartAt === 0) { - this._recursivelyRemoveChildrenFromMap(bounds, depthToAnimateIn); //TODO: previousBounds, not bounds - - } else { - for (i = childClusters.length - 1; i >= 0; i--) { - if (bounds.intersects(childClusters[i]._bounds)) { - childClusters[i]._recursivelyRemoveChildrenAndAddNowVisibleMarkers(bounds, depthToStartAt - 1, depthToAnimateIn - 1); - } - } - - if (depthToStartAt == 1) { - for (i = markers.length - 1; i >= 0; i--) { - var m = markers[i]; - if (bounds.contains(m._latlng)) { - L.FeatureGroup.prototype.addLayer.call(this._group, m); - } - } - } - } + this._recursively(bounds, depthToStartAt, 0, null, function (c) { + c._recursivelyRemoveChildrenFromMap(bounds, depthToAnimateIn - 1); + }); }, _recursivelyAnimateChildrenIn: function (bounds, center, depth) {