[Pkg-javascript-commits] [leaflet-markercluster] 154/219: Added hasLayer check for singleMarkerMode refresh

Jonas Smedegaard dr at jones.dk
Sat May 7 09:39:29 UTC 2016


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

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

commit 54c642c132988d5cfb242dc014418dcb7cdad618
Author: ghybs <ghybs1 at gmail.com>
Date:   Wed Oct 21 14:16:41 2015 +0400

    Added hasLayer check for singleMarkerMode refresh
    
    to avoid overriding icons of markers that do not belong to the current MCG.
    Otherwise, we change icons that have nothing to do with the group.
    Following comment https://github.com/Leaflet/Leaflet.markercluster/pull/583#issuecomment-149771591
---
 src/MarkerClusterGroup.Refresh.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/MarkerClusterGroup.Refresh.js b/src/MarkerClusterGroup.Refresh.js
index 11f8ccd..f8f8eab 100644
--- a/src/MarkerClusterGroup.Refresh.js
+++ b/src/MarkerClusterGroup.Refresh.js
@@ -85,8 +85,12 @@ L.MarkerClusterGroup.include({
 
 		for (id in layers) {
 			layer = layers[id];
-			// Need to re-create the icon first, then re-draw the marker.
-			layer.setIcon(this._overrideMarkerIcon(layer));
+
+			// Make sure we do not override markers that do not belong to THIS group.
+			if (this.hasLayer(layer)) {
+				// Need to re-create the icon first, then re-draw the marker.
+				layer.setIcon(this._overrideMarkerIcon(layer));
+			}
 		}
 	}
 });

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