[Pkg-javascript-commits] [leaflet-markercluster] 131/479: Support removing markers down to 0.

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:20 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 ff686786e47339ba983aa288d87d538d731fae4f
Author: danzel <danzel at localhost.geek.nz>
Date:   Mon Jul 30 11:11:56 2012 +1200

    Support removing markers down to 0.
---
 src/MarkerCluster.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js
index 9876845..a157df5 100644
--- a/src/MarkerCluster.js
+++ b/src/MarkerCluster.js
@@ -185,9 +185,9 @@ L.MarkerCluster = L.Marker.extend({
 				}
 
 				markers.splice(i, 1);
+				this._childCount--;
 				this._recalculateBounds();
 		
-				this._childCount--;
 				if (!('_zoom' in this)) {
 					this.setIcon(group.options.iconCreateFunction(this._childCount));
 				}
@@ -425,7 +425,11 @@ L.MarkerCluster = L.Marker.extend({
 			this._bounds.extend(childClusters[i]._bounds);
 		}
 
-		this.setLatLng(this._bounds.getCenter());
+		if (this._childCount == 0) {
+			delete this._latlng;
+		} else {
+			this.setLatLng(this._bounds.getCenter());
+		}
 	},
 
 

-- 
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