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.
This commit is contained in:
danzel
2013-12-18 10:16:14 +13:00
parent 957a69dc2b
commit 6d12053b5b
+14
View File
@@ -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;
}