[Pkg-javascript-commits] [leaflet-markercluster] 456/479: Prevent multiple clustermouseover/off events if the icon is made up of stacked divs. Fixes #252.

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:01:07 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 6d12053b5b1cb0f2dd884847c5d2ba5a82a21db9
Author: danzel <danzel at localhost.geek.nz>
Date:   Wed Dec 18 10:16:14 2013 +1300

    Prevent multiple clustermouseover/off events if the icon is made up of stacked divs. Fixes #252.
    
    Doesn't fix this bug in IE <= 8 as they don't support relatedTarget, could fix it by looking at the event type and using fromElement/toElement, but I'm not going to.
---
 src/MarkerClusterGroup.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 313d8e2..476b8e0 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -547,8 +547,22 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 		delete marker.__parent;
 	},
 
+	_isOrIsParent: function (el, oel) {
+		while (oel) {
+			if (el === oel) {
+				return true;
+			}
+			oel = oel.parentNode;
+		}
+		return false;
+	},
+
 	_propagateEvent: function (e) {
 		if (e.layer instanceof L.MarkerCluster) {
+			//Prevent multiple clustermouseover/off events if the icon is made up of stacked divs (Doesn't work in ie <= 8, no relatedTarget)
+			if (this._isOrIsParent(e.layer._icon, e.originalEvent.relatedTarget)) {
+				return;
+			}
 			e.type = 'cluster' + e.type;
 		}
 

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