From 1afb83b91da9d0a88701c4900f13079a1edc8883 Mon Sep 17 00:00:00 2001 From: danzel Date: Thu, 20 Sep 2012 10:39:00 +1200 Subject: [PATCH] For animated zoomouts sometimes we'll zoom so that the previously visible bounds aren't fully contained within the new bounds, in those cases we need to remove the markers that were in the previous bounds but not the new bounds from the map as the normal animation won't take care of them. Fixes #63 --- src/MarkerClusterGroup.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js index be5fbb781..8286bc891 100644 --- a/src/MarkerClusterGroup.js +++ b/src/MarkerClusterGroup.js @@ -636,6 +636,8 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? { //Need to add markers for those that weren't on the map before but are now this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds()); + //Remove markers that were on the map before but won't be now + this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel, this._getExpandedVisibleBounds()); }, _animationZoomOutSingle: function (cluster, previousZoomLevel, newZoomLevel) { var bounds = this._getExpandedVisibleBounds();