[Pkg-javascript-commits] [leaflet-markercluster] 132/479: Update build and update to build :)

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:20 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 f0414083ddbd1f19852f83105942ec0abd5deea2
Author: danzel <danzel at localhost.geek.nz>
Date:   Mon Jul 30 11:12:54 2012 +1200

    Update build and update to build :)
---
 dist/leaflet.markercluster-src.js | 22 ++++++++++++++++------
 dist/leaflet.markercluster.js     |  2 +-
 src/MarkerCluster.js              |  4 ++--
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/dist/leaflet.markercluster-src.js b/dist/leaflet.markercluster-src.js
index b5b845d..c42f7b7 100644
--- a/dist/leaflet.markercluster-src.js
+++ b/dist/leaflet.markercluster-src.js
@@ -314,15 +314,15 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 
 		return { 'clusters': clusters, 'unclustered': unclustered };
 	},
-
+	
 	//Clusters the given markers (with _cluster) and returns the result as a MarkerCluster
 	_clusterToMarkerCluster: function (toCluster, zoom) {
 		var res = this._cluster(toCluster, zoom),
 			toAdd = res.clusters.concat(res.unclustered),
-			result = new L.MarkerCluster(this, toAdd[0]),
+			result = new L.MarkerCluster(this),
 			i;
 
-		for (i = toAdd.length - 1; i > 0; i--) {
+		for (i = toAdd.length - 1; i >= 0; i--) {
 			result._addChild(toAdd[i]);
 		}
 		result._zoom = zoom;
@@ -522,7 +522,9 @@ L.MarkerCluster = L.Marker.extend({
 
 		this._bounds = new L.LatLngBounds();
 
-		this._addChild(a);
+		if (a) {
+			this._addChild(a);
+		}
 		if (b) {
 			this._addChild(b);
 		}
@@ -670,6 +672,10 @@ L.MarkerCluster = L.Marker.extend({
 	},
 
 	_canAcceptPosition: function (latlng, zoom) {
+		if (this._childCount === 0) {
+			return true;
+		}
+
 		var clusterRadiusSqrd = this._group.options.maxClusterRadius * this._group.options.maxClusterRadius,
 			pos = this._group._map.project(this._latlng, zoom),
 			otherpos = this._group._map.project(latlng, zoom);
@@ -693,9 +699,9 @@ L.MarkerCluster = L.Marker.extend({
 				}
 
 				markers.splice(i, 1);
+				this._childCount--;
 				this._recalculateBounds();
 		
-				this._childCount--;
 				if (!('_zoom' in this)) {
 					this.setIcon(group.options.iconCreateFunction(this._childCount));
 				}
@@ -933,7 +939,11 @@ L.MarkerCluster = L.Marker.extend({
 			this._bounds.extend(childClusters[i]._bounds);
 		}
 
-		this.setLatLng(this._bounds.getCenter());
+		if (this._childCount === 0) {
+			delete this._latlng;
+		} else {
+			this.setLatLng(this._bounds.getCenter());
+		}
 	},
 
 
diff --git a/dist/leaflet.markercluster.js b/dist/leaflet.markercluster.js
index ba8273b..f5b23bb 100644
--- a/dist/leaflet.markercluster.js
+++ b/dist/leaflet.markercluster.js
@@ -3,4 +3,4 @@
  Leaflet.markercluster is an open-source JavaScript library for Marker Clustering on leaflet powered maps.
  https://github.com/danzel/Leaflet.markercluster
 */
-(function(e,t){L.MarkerClusterGroup=L.FeatureGroup.extend({options:{maxClusterRadius:60,iconCreateFunction:null,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0},initialize:function(e){L.Util.setOptions(this,e),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._defaultIconCreateFunction),L.FeatureGroup.prototype.initialize.call(this,[]),this._inZoomAnimation=0,this._needsClustering=[],this._currentShownBounds=null},addLayer:function(e){if(!this._map [...]
\ No newline at end of file
+(function(e,t){L.MarkerClusterGroup=L.FeatureGroup.extend({options:{maxClusterRadius:60,iconCreateFunction:null,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0},initialize:function(e){L.Util.setOptions(this,e),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._defaultIconCreateFunction),L.FeatureGroup.prototype.initialize.call(this,[]),this._inZoomAnimation=0,this._needsClustering=[],this._currentShownBounds=null},addLayer:function(e){if(!this._map [...]
\ No newline at end of file
diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js
index a157df5..cc73b0c 100644
--- a/src/MarkerCluster.js
+++ b/src/MarkerCluster.js
@@ -158,7 +158,7 @@ L.MarkerCluster = L.Marker.extend({
 	},
 
 	_canAcceptPosition: function (latlng, zoom) {
-		if (this._childCount == 0) {
+		if (this._childCount === 0) {
 			return true;
 		}
 
@@ -425,7 +425,7 @@ L.MarkerCluster = L.Marker.extend({
 			this._bounds.extend(childClusters[i]._bounds);
 		}
 
-		if (this._childCount == 0) {
+		if (this._childCount === 0) {
 			delete this._latlng;
 		} else {
 			this.setLatLng(this._bounds.getCenter());

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