Working on removeLayer, works so long as no cluster ever needs removing

This commit is contained in:
danzel
2012-09-11 11:28:14 +12:00
parent c683bac226
commit 761d265732
2 changed files with 3 additions and 7 deletions
+2 -1
View File
@@ -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;
+1 -6
View File
@@ -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;
},