From 55d221c9e19769a97b54c5fdce5d3b097c7d87c7 Mon Sep 17 00:00:00 2001 From: danzel Date: Fri, 20 Jul 2012 16:15:07 +1200 Subject: [PATCH] Fix-Fix double childCount adding bug. Fix broken icon after add bug --- src/MarkerCluster.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js index e3d1abbf9..310acffd7 100644 --- a/src/MarkerCluster.js +++ b/src/MarkerCluster.js @@ -87,7 +87,6 @@ L.MarkerCluster = L.Marker.extend({ if (!this._haveGeneratedChildClusters && this._canAcceptPosition(layer.getLatLng(), zoom)) { //Don't need to cluster it in as we haven't clustered this._addChild(layer); - this._childCount++; result = true; } else { for (var i = this._childClusters.length - 1; i >= 0; i--) { @@ -119,9 +118,9 @@ L.MarkerCluster = L.Marker.extend({ } if (result) { - //if (!this._zoom) { //TODO: Enable this when i've tracked the weird bug + if (!this._zoom) { this.setIcon(this._group.options.iconCreateFunction(this._childCount)); - //} + } this._recalculateBounds(); } if (result === true) {