[Pkg-javascript-commits] [leaflet-markercluster] 395/479: Update build.

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:01:00 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 f1886fa9f866ecb563178ecd78ffb7774093d29f
Author: danzel <danzel at localhost.geek.nz>
Date:   Mon Jun 24 10:23:59 2013 +1200

    Update build.
---
 dist/leaflet.markercluster-src.js | 102 +++++++++++++++++++-------------------
 dist/leaflet.markercluster.js     |   2 +-
 2 files changed, 53 insertions(+), 51 deletions(-)

diff --git a/dist/leaflet.markercluster-src.js b/dist/leaflet.markercluster-src.js
index ddc54db..4f1d7df 100644
--- a/dist/leaflet.markercluster-src.js
+++ b/dist/leaflet.markercluster-src.js
@@ -550,58 +550,60 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 	},
 
 	_bindEvents: function () {
-		var shownPolygon = null,
-			map = this._map,
-
-			spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom,
-			showCoverageOnHover = this.options.showCoverageOnHover,
-			zoomToBoundsOnClick = this.options.zoomToBoundsOnClick;
+		var map = this._map,
+		    spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom,
+		    showCoverageOnHover = this.options.showCoverageOnHover,
+		    zoomToBoundsOnClick = this.options.zoomToBoundsOnClick;
 
 		//Zoom on cluster click or spiderfy if we are at the lowest level
 		if (spiderfyOnMaxZoom || zoomToBoundsOnClick) {
-			this.on('clusterclick', function (a) {
-				if (map.getMaxZoom() === map.getZoom()) {
-					if (spiderfyOnMaxZoom) {
-						a.layer.spiderfy();
-					}
-				} else if (zoomToBoundsOnClick) {
-					a.layer.zoomToBounds();
-				}
-			}, this);
+			this.on('clusterclick', this._zoomOrSpiderfy, this);
 		}
 
 		//Show convex hull (boundary) polygon on mouse over
 		if (showCoverageOnHover) {
-			this.on('clustermouseover', function (a) {
-				if (this._inZoomAnimation) {
-					return;
-				}
-				if (shownPolygon) {
-					map.removeLayer(shownPolygon);
-				}
-				if (a.layer.getChildCount() > 2 && a.layer !== this._spiderfied) {
-					shownPolygon = new L.Polygon(a.layer.getConvexHull(), this.options.polygonOptions);
-					map.addLayer(shownPolygon);
-				}
-			}, this);
-			this.on('clustermouseout', function () {
-				if (shownPolygon) {
-					map.removeLayer(shownPolygon);
-					shownPolygon = null;
-				}
-			}, this);
-			map.on('zoomend', function () {
-				if (shownPolygon) {
-					map.removeLayer(shownPolygon);
-					shownPolygon = null;
-				}
-			}, this);
-			map.on('layerremove', function (opt) {
-				if (shownPolygon && opt.layer === this) {
-					map.removeLayer(shownPolygon);
-					shownPolygon = null;
-				}
-			}, this);
+			this.on('clustermouseover', this._showCoverage, this);
+			this.on('clustermouseout', this._hideCoverage, this);
+			map.on('zoomend', this._hideCoverage, this);
+			map.on('layerremove', this._hideCoverageOnRemove, this);
+		}
+	},
+
+	_zoomOrSpiderfy: function (e) {
+		var map = this._map;
+		if (map.getMaxZoom() === map.getZoom()) {
+			if (this.options.spiderfyOnMaxZoom) {
+				e.layer.spiderfy();
+			}
+		} else if (this.options.zoomToBoundsOnClick) {
+			e.layer.zoomToBounds();
+		}
+	},
+
+	_showCoverage: function (e) {
+		var map = this._map;
+		if (this._inZoomAnimation) {
+			return;
+		}
+		if (this._shownPolygon) {
+			map.removeLayer(this._shownPolygon);
+		}
+		if (e.layer.getChildCount() > 2 && e.layer !== this._spiderfied) {
+			this._shownPolygon = new L.Polygon(e.layer.getConvexHull(), this.options.polygonOptions);
+			map.addLayer(this._shownPolygon);
+		}
+	},
+
+	_hideCoverage: function () {
+		if (this._shownPolygon) {
+			this._map.removeLayer(this._shownPolygon);
+			this._shownPolygon = null;
+		}
+	},
+
+	_hideCoverageOnRemove: function (e) {
+		if (e.layer === this) {
+			this._hideCoverage();
 		}
 	},
 
@@ -612,13 +614,13 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 			map = this._map;
 
 		if (spiderfyOnMaxZoom || zoomToBoundsOnClick) {
-			this.off('clusterclick', null, this);
+			this.off('clusterclick', this._zoomOrSpiderfy, this);
 		}
 		if (showCoverageOnHover) {
-			this.off('clustermouseover', null, this);
-			this.off('clustermouseout', null, this);
-			map.off('zoomend', null, this);
-			map.off('layerremove', null, this);
+			this.off('clustermouseover', this._showCoverage, this);
+			this.off('clustermouseout', this._hideCoverage, this);
+			map.off('zoomend', this._hideCoverage, this);
+			map.off('layerremove', this._hideCoverageOnRemove, this);
 		}
 	},
 
diff --git a/dist/leaflet.markercluster.js b/dist/leaflet.markercluster.js
index a593f8c..be50d1f 100644
--- a/dist/leaflet.markercluster.js
+++ b/dist/leaflet.markercluster.js
@@ -3,4 +3,4 @@
  https://github.com/Leaflet/Leaflet.markercluster
  (c) 2012-2013, Dave Leaver, smartrak
 */
-!function(t,e){L.MarkerClusterGroup=L.FeatureGroup.extend({options:{maxClusterRadius:80,iconCreateFunction:null,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0,singleMarkerMode:!1,disableClusteringAtZoom:null,removeOutsideVisibleBounds:!0,animateAddingMarkers:!1,spiderfyDistanceMultiplier:1,polygonOptions:{}},initialize:function(t){L.Util.setOptions(this,t),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._defaultIconCreateFunction),this._featureG [...]
\ No newline at end of file
+!function(t,e){L.MarkerClusterGroup=L.FeatureGroup.extend({options:{maxClusterRadius:80,iconCreateFunction:null,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0,singleMarkerMode:!1,disableClusteringAtZoom:null,removeOutsideVisibleBounds:!0,animateAddingMarkers:!1,spiderfyDistanceMultiplier:1,polygonOptions:{}},initialize:function(t){L.Util.setOptions(this,t),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._defaultIconCreateFunction),this._featureG [...]
\ No newline at end of file

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