[Pkg-javascript-commits] [leaflet-markercluster] 01/128: Change event propagation overrides to work with leaflet master code.
Jonas Smedegaard
dr at jones.dk
Sun Apr 16 06:25:57 UTC 2017
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository leaflet-markercluster.
commit bc463e42c335441a343e20ed6c66a5450ef7c8e3
Author: danzel <danzel at localhost.geek.nz>
Date: Wed Jan 29 14:42:10 2014 +1300
Change event propagation overrides to work with leaflet master code.
---
src/MarkerClusterGroup.js | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index cc7de90..e261291 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -43,10 +43,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
}
this._featureGroup = L.featureGroup();
- this._featureGroup.on(L.FeatureGroup.EVENTS, this._propagateEvent, this);
+ this._featureGroup.addEventParent(this);
this._nonPointGroup = L.featureGroup();
- this._nonPointGroup.on(L.FeatureGroup.EVENTS, this._propagateEvent, this);
+ this._nonPointGroup.addEventParent(this);
this._inZoomAnimation = 0;
this._needsClustering = [];
@@ -443,8 +443,8 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
throw "Map has no maxZoom specified";
}
- this._featureGroup.onAdd(map);
- this._nonPointGroup.onAdd(map);
+ this._featureGroup.addTo(map);
+ this._nonPointGroup.addTo(map);
if (!this._gridClusters) {
this._generateInitialClusters();
@@ -493,8 +493,8 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Clean up all the layers we added to the map
this._hideCoverage();
- this._featureGroup.onRemove(map);
- this._nonPointGroup.onRemove(map);
+ this._featureGroup.remove();
+ this._nonPointGroup.remove();
this._featureGroup.clearLayers();
@@ -593,16 +593,22 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
return false;
},
- _propagateEvent: function (e) {
- if (e.layer instanceof L.MarkerCluster) {
+ //Override L.Evented.fire
+ fire: function (type, data, propagate) {
+ if (data && data.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 (e.originalEvent && this._isOrIsParent(e.layer._icon, e.originalEvent.relatedTarget)) {
+ if (data.originalEvent && this._isOrIsParent(data.layer._icon, data.originalEvent.relatedTarget)) {
return;
}
- e.type = 'cluster' + e.type;
+ type = 'cluster' + type;
}
- this.fire(e.type, e);
+ L.FeatureGroup.prototype.fire.call(this, type, data, propagate);
+ },
+
+ //Override L.Evented.listens
+ listens: function (type, propagate) {
+ return L.FeatureGroup.prototype.listens.call(this, type, propagate) || L.FeatureGroup.prototype.listens.call(this, 'cluster' + type, propagate);
},
//Default functionality
--
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