[Pkg-javascript-commits] [leaflet-markercluster] 65/479: Fix child counting bug

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:10 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository leaflet-markercluster.

commit a944d7de441ce4d3690f06a39166285a3cf31f16
Author: danzel <danzel at localhost.geek.nz>
Date:   Fri Jul 20 16:03:14 2012 +1200

    Fix child counting bug
---
 src/MarkerCluster.js | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js
index 5515329..e3d1abb 100644
--- a/src/MarkerCluster.js
+++ b/src/MarkerCluster.js
@@ -87,6 +87,7 @@ 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--) {
@@ -95,6 +96,7 @@ L.MarkerCluster = L.Marker.extend({
 				if (c._bounds.contains(layer.getLatLng()) || c._canAcceptPosition(layer.getLatLng(), zoom + 1)) {
 					result = c._recursivelyAddLayer(layer, zoom + 1);
 					if (result) {
+						this._childCount++;
 						break;
 					}
 				}
@@ -114,15 +116,14 @@ L.MarkerCluster = L.Marker.extend({
 					result = true;
 				}
 			}
-
-			if (result) {
-				this._childCount++;
-				if (this._icon) {
-					this.setIcon(this._group.options.iconCreateFunction(this._childCount));
-				}
-			}
 		}
 
+		if (result) {
+			//if (!this._zoom) { //TODO: Enable this when i've tracked the weird bug
+				this.setIcon(this._group.options.iconCreateFunction(this._childCount));
+			//}
+			this._recalculateBounds();
+		}
 		if (result === true) {
 			if (this._icon) {
 				result = this;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet-markercluster.git



More information about the Pkg-javascript-commits mailing list