[Pkg-javascript-commits] [leaflet-markercluster] 159/479: Update Build

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:25 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 eee1aba84766e4b32a8337479f5c86cf525eab33
Author: danzel <danzel at localhost.geek.nz>
Date:   Fri Aug 10 16:05:57 2012 +1200

    Update Build
---
 dist/leaflet.markercluster-src.js | 29 ++++++++++++++++++++++-------
 dist/leaflet.markercluster.js     |  2 +-
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/dist/leaflet.markercluster-src.js b/dist/leaflet.markercluster-src.js
index 0460b78..abddbcb 100644
--- a/dist/leaflet.markercluster-src.js
+++ b/dist/leaflet.markercluster-src.js
@@ -584,8 +584,9 @@ L.MarkerCluster = L.Marker.extend({
 	_baseInit: function () {
 		L.Marker.prototype.initialize.call(this, this._latlng, { icon: this._group.options.iconCreateFunction(this._childCount) });
 	},
-	
+
 	_addChild: function (new1) {
+		this._expandBounds(new1);
 		if (new1 instanceof L.MarkerCluster) {
 			this._childClusters.push(new1);
 			this._childCount += new1._childCount;
@@ -598,18 +599,31 @@ L.MarkerCluster = L.Marker.extend({
 			this.setIcon(this._group.options.iconCreateFunction(this._childCount));
 		}
 
-		this._expandBounds(new1);
 	},
 
 	_expandBounds: function (marker) {
 
+		var addedCount,
+		    addedLatLng;
+
 		if (marker instanceof L.MarkerCluster) {
 			this._bounds.extend(marker._bounds);
+			addedCount = marker._childCount;
+			addedLatLng = marker._latlng;
 		} else {
-			this._bounds.extend(marker.getLatLng());
+			addedLatLng = marker.getLatLng();
+			this._bounds.extend(addedLatLng);
+			addedCount = 1;
 		}
 
-		this._latlng = this._bounds.getCenter();
+		var totalCount = this._childCount + addedCount;
+
+		if (!this._latlng) {
+			this._latlng = new L.LatLng(addedLatLng.lat, addedLatLng.lng);
+		} else {
+			this._latlng.lat = (addedLatLng.lat * addedCount + this._latlng.lat * this._childCount) / totalCount;
+			this._latlng.lng = (addedLatLng.lng * addedCount + this._latlng.lng * this._childCount) / totalCount;
+		}
 	},
 
 	//Set our markers position as given and add it to the map
@@ -749,7 +763,7 @@ L.MarkerCluster = L.Marker.extend({
 				markers.splice(i, 1);
 				this._childCount--;
 				this._recalculateBounds();
-		
+
 				if (!('_zoom' in this)) {
 					this.setIcon(group.options.iconCreateFunction(this._childCount));
 				}
@@ -775,7 +789,7 @@ L.MarkerCluster = L.Marker.extend({
 						L.FeatureGroup.prototype.removeLayer.call(group, child);
 						L.FeatureGroup.prototype.addLayer.call(group, child._markers[0]);
 					}
-					
+
 					//Take ownership of its only marker and bin the cluster
 					markers.push(child._markers[0]);
 					childClusters.splice(i, 1);
@@ -907,7 +921,7 @@ L.MarkerCluster = L.Marker.extend({
 			delete this._backupLatlng;
 		}
 	},
-	
+
 	//exceptBounds: If set, don't remove any markers/clusters in it
 	_recursivelyRemoveChildrenFromMap: function (previousBounds, depth, exceptBounds) {
 		var m, i;
@@ -1003,6 +1017,7 @@ L.MarkerCluster = L.Marker.extend({
 });
 
 
+
 L.DistanceGrid = function (cellSize) {
 	this._cellSize = cellSize;
 	this._sqCellSize = cellSize * cellSize;
diff --git a/dist/leaflet.markercluster.js b/dist/leaflet.markercluster.js
index d9dd317..d593fca 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

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