[Pkg-javascript-commits] [leaflet-markercluster] 306/479: Fix #114 bug 1.

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:45 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 4afda973fcf308697430e91c4f1717e9109d9469
Author: danzel <danzel at localhost.geek.nz>
Date:   Wed Jan 9 11:17:16 2013 +1300

    Fix #114 bug 1.
---
 src/MarkerClusterGroup.js | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 028fc0c..f36019c 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -118,13 +118,14 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 
 	//Takes an array of markers and adds them in bulk
 	addLayers: function (layersArray) {
+		var i, l, m;
 		if (!this._map) {
 			this._needsClustering = this._needsClustering.concat(layersArray);
 			return this;
 		}
 
-		for (var i = 0, l = layersArray.length; i < l; i++) {
-			var m = layersArray[i];
+		for (i = 0, l = layersArray.length; i < l; i++) {
+			m = layersArray[i];
 
 			if (this.hasLayer(m)) {
 				continue;
@@ -141,6 +142,17 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 				}
 			}
 		}
+
+		//Update the icons of all those visible clusters that were affected
+		for (i in this._layers) {
+			if (this._layers.hasOwnProperty(i)) {
+				m = this._layers[i];
+				if (m instanceof L.MarkerCluster && m._iconNeedsUpdate) {
+					m._updateIcon();
+				}
+			}
+		}
+
 		this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
 
 		return 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