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

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:30 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 7ae3e1ad42fcce2e25c02e0cb0a214dca09a1e2a
Author: danzel <danzel at localhost.geek.nz>
Date:   Thu Sep 6 16:20:02 2012 +1200

    Update build
---
 dist/leaflet.markercluster-src.js | 32 +++++++++++++++++++++++---------
 dist/leaflet.markercluster.js     |  2 +-
 2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/dist/leaflet.markercluster-src.js b/dist/leaflet.markercluster-src.js
index a871114..5192e06 100644
--- a/dist/leaflet.markercluster-src.js
+++ b/dist/leaflet.markercluster-src.js
@@ -23,7 +23,11 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 
 		disableClusteringAtZoom: null,
 
-		skipDuplicateAddTesting: false
+		skipDuplicateAddTesting: false,
+
+		//Whether to animate adding markers after adding the MarkerClusterGroup to the map
+		// If you are adding individual markers set to true, if adding bulk markers leave false for massive performance gains.
+		animateAddingMarkers: false
 	},
 
 	initialize: function (options) {
@@ -79,8 +83,11 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 
 		var newCluster = this._topClusterLevel._recursivelyAddLayer(layer, this._topClusterLevel._zoom - 1);
 
-		this._animationAddLayer(layer, newCluster);
-
+		if (this.options.animateAddingMarkers) {
+			this._animationAddLayer(layer, newCluster);
+		} else {
+			this._animationAddLayerNonAnimated(layer, newCluster);
+		}
 		return this;
 	},
 
@@ -432,6 +439,16 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 			ne = map.unproject(new L.Point(bounds.max.x + width, bounds.max.y + height));
 
 		return new L.LatLngBounds(sw, ne);
+	},
+
+	//Shared animation code
+	_animationAddLayerNonAnimated: function (layer, newCluster) {
+		if (newCluster === true) {
+			L.FeatureGroup.prototype.addLayer.call(this, layer);
+		} else if (newCluster._childCount === 2) {
+			newCluster._addToMap();
+			newCluster._recursivelyRemoveChildrenFromMap(newCluster._bounds, this._map.getMaxZoom()); //getMaxZoom will always get all children
+		}
 	}
 });
 
@@ -450,12 +467,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 		this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel - this._topClusterLevel._zoom + 1, this._getExpandedVisibleBounds());
 	},
 	_animationAddLayer: function (layer, newCluster) {
-		if (newCluster === true) {
-			L.FeatureGroup.prototype.addLayer.call(this, layer);
-		} else if (newCluster._childCount === 2) {
-			newCluster._addToMap();
-			newCluster._recursivelyRemoveChildrenFromMap(newCluster._bounds, this._map.getMaxZoom()); //getMaxZoom will always get all children
-		}
+		this._animationAddLayerNonAnimated(layer, newCluster);
 	}
 } : {
 
@@ -1664,6 +1676,8 @@ L.MarkerClusterGroup.include({
 		this._map.off('click', this._unspiderfyWrapper, this);
 		this._map.off('zoomstart', this._unspiderfyZoomStart, this);
 		this._map.off('zoomanim', this._unspiderfyZoomAnim, this);
+
+		this._unspiderfy(); //Ensure that markers are back where they should be
 	},
 
 
diff --git a/dist/leaflet.markercluster.js b/dist/leaflet.markercluster.js
index c119720..de2f5d5 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:80,iconCreateFunction:null,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0,singleMarkerMode:!1,disableClusteringAtZoom:null,skipDuplicateAddTesting:!1},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._needsClu [...]
\ No newline at end of file
+(function(e,t){L.MarkerClusterGroup=L.FeatureGroup.extend({options:{maxClusterRadius:80,iconCreateFunction:null,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0,singleMarkerMode:!1,disableClusteringAtZoom:null,skipDuplicateAddTesting:!1,animateAddingMarkers:!1},initialize:function(e){L.Util.setOptions(this,e),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._defaultIconCreateFunction),L.FeatureGroup.prototype.initialize.call(this,[]),this._inZoomAn [...]
\ 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