[Pkg-javascript-commits] [leaflet-markercluster] 285/479: When initially adding layers, skip layers that are already added. Fixes adding the same layer multiple times before adding the MarkerClusterGroup to the map. Refs #44

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:40 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 17f32ab1f8a46856e828d6dec914999fdb826b73
Author: danzel <danzel at localhost.geek.nz>
Date:   Fri Nov 9 15:53:21 2012 +1300

    When initially adding layers, skip layers that are already added. Fixes adding the same layer multiple times before adding the MarkerClusterGroup to the map. Refs #44
---
 src/MarkerClusterGroup.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 850a937..e6635b8 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -283,7 +283,11 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 		}
 
 		for (var i = 0, l = this._needsClustering.length; i < l; i++) {
-			this._addLayer(this._needsClustering[i], this._maxZoom);
+			var layer = this._needsClustering[i];
+			if (layer.__parent) {
+				continue;
+			}
+			this._addLayer(layer, this._maxZoom);
 		}
 		this._needsClustering = [];
 

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