From fee3c02705f008bff99b68cf512e444a92eb538f Mon Sep 17 00:00:00 2001 From: danzel Date: Wed, 25 Jul 2012 16:35:19 +1200 Subject: [PATCH] Fix removeLayer updating count on icon --- src/MarkerCluster.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js index 37012ec98..fd96dade0 100644 --- a/src/MarkerCluster.js +++ b/src/MarkerCluster.js @@ -182,7 +182,7 @@ L.MarkerCluster = L.Marker.extend({ this._recalculateBounds(); this._childCount--; - if (this._icon) { + if (!('_zoom' in this)) { this.setIcon(group.options.iconCreateFunction(this._childCount)); } return true; @@ -195,6 +195,9 @@ L.MarkerCluster = L.Marker.extend({ if (child._bounds.contains(layer._latlng) && child._recursivelyRemoveLayer(layer)) { this._childCount--; + if (!('_zoom' in this)) { + this.setIcon(group.options.iconCreateFunction(this._childCount)); + } //if our child cluster is no longer a cluster, remove it and replace with just the marker if (child._childCount === 1) {