From 761d2657324e88b533b8b1a4e464346146cedb03 Mon Sep 17 00:00:00 2001 From: danzel Date: Tue, 11 Sep 2012 11:28:14 +1200 Subject: [PATCH] Working on removeLayer, works so long as no cluster ever needs removing --- src/MarkerCluster.js | 3 ++- src/MarkerClusterGroup.js | 7 +------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js index 5763f3ae9..5eb9c42dc 100644 --- a/src/MarkerCluster.js +++ b/src/MarkerCluster.js @@ -91,7 +91,7 @@ L.MarkerCluster = L.Marker.extend({ _removeChildMarker: function (marker) { var markers = this._markers, - group = this._group, i; + i; for (i = markers.length - 1; i >= 0; i--) { if (markers[i] === marker) { @@ -101,6 +101,7 @@ L.MarkerCluster = L.Marker.extend({ while (p) { p._childCount--; p._recalculateBounds(); + p._updateIcon(); p = p._parent; } return true; diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js index 2fabc920b..17627620d 100644 --- a/src/MarkerClusterGroup.js +++ b/src/MarkerClusterGroup.js @@ -103,12 +103,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({ this._unspiderfyLayer(layer); } - if (!this._topClusterLevel._recursivelyRemoveLayer(layer)) { - //If this happens you are doing something bad - //If you've moved a marker that is in the cluster then that would be why - //console.log('failed to remove'); - var a = 0; - } + layer.__cluster._removeChildMarker(layer); return this; },