[Pkg-javascript-commits] [leaflet-markercluster] 104/128: Tidy up all these event handlers we now need to add.

Jonas Smedegaard dr at jones.dk
Sun Apr 16 06:26:08 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 dbdedb93e87e0e41fb4c93fcfce0ba0656a8f4df
Author: danzel <dave at smartrak.co.nz>
Date:   Thu Jan 26 14:52:37 2017 +1300

    Tidy up all these event handlers we now need to add.
---
 src/MarkerClusterGroup.js | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 294017f..e9eec0b 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -64,6 +64,12 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 
 		this._queue = [];
 
+		this._childMarkerEventHandlers = {
+			'dragstart': this._childMarkerDragStart,
+			'move': this._childMarkerMoved,
+			'dragend': this._childMarkerDragEnd,
+		};
+
 		// Hook the appropriate animation methods.
 		var animate = L.DomUtil.TRANSITION && this.options.animate;
 		L.extend(this, animate ? this._withAnimation : this._noAnimation);
@@ -161,9 +167,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 
 		this._refreshClustersIcons();
 
-		layer.off('dragstart', this._childMarkerDragStart, this);
-		layer.off('move', this._childMarkerMoved, this);
-		layer.off('dragend', this._childMarkerDragEnd, this);
+		layer.off(this._childMarkerEventHandlers, this);
 
 		if (this._featureGroup.hasLayer(layer)) {
 			this._featureGroup.removeLayer(layer);
@@ -409,9 +413,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 		this._nonPointGroup.clearLayers();
 
 		this.eachLayer(function (marker) {
-			marker.off('dragstart', this._childMarkerDragStart, this);
-			marker.off('move', this._childMarkerMoved, this);
-			marker.off('dragend', this._childMarkerDragEnd, this);
+			marker.off(this._childMarkerEventHandlers, this);
 			delete marker.__parent;
 		}, this);
 
@@ -921,9 +923,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 			this._overrideMarkerIcon(layer);
 		}
 
-		layer.on('dragstart', this._childMarkerDragStart, this);
-		layer.on('move', this._childMarkerMoved, this);
-		layer.on('dragend', this._childMarkerDragEnd, this);
+		layer.on(this._childMarkerEventHandlers, this);
 
 		//Find the lowest zoom level to slot this one in
 		for (; zoom >= minZoom; zoom--) {

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