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

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:50 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 6fda9a206f47f446bd42a931caa4a68aaca511d9
Author: danzel <danzel at localhost.geek.nz>
Date:   Fri Apr 26 09:59:28 2013 +1200

    Update build
---
 dist/leaflet.markercluster-src.js | 37 +++++++++++++++++++++++++++----------
 dist/leaflet.markercluster.js     |  2 +-
 2 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/dist/leaflet.markercluster-src.js b/dist/leaflet.markercluster-src.js
index 463002f..9b8b6ef 100644
--- a/dist/leaflet.markercluster-src.js
+++ b/dist/leaflet.markercluster-src.js
@@ -48,6 +48,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 
 		this._inZoomAnimation = 0;
 		this._needsClustering = [];
+		this._needsRemoving = []; //Markers removed while we aren't on the map need to be kept track of
 		//The bounds of the currently shown area (from _getExpandedVisibleBounds) Updated on zoom/move
 		this._currentShownBounds = null;
 	},
@@ -101,7 +102,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 	removeLayer: function (layer) {
 
 		if (!this._map) {
-			this._arraySplice(this._needsClustering, layer);
+			if (!this._arraySplice(this._needsClustering, layer) && this.hasLayer(layer)) {
+				this._needsRemoving.push(layer);
+			}
 			return this;
 		}
 
@@ -269,12 +272,18 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 			return false;
 		}
 
-		if (this._needsClustering.length > 0) {
-			var anArray = this._needsClustering;
-			for (var i = anArray.length - 1; i >= 0; i--) {
-				if (anArray[i] === layer) {
-					return true;
-				}
+		var i, anArray = this._needsClustering;
+
+		for (i = anArray.length - 1; i >= 0; i--) {
+			if (anArray[i] === layer) {
+				return true;
+			}
+		}
+
+		anArray = this._needsRemoving;
+		for (i = anArray.length - 1; i >= 0; i--) {
+			if (anArray[i] === layer) {
+				return false;
 			}
 		}
 
@@ -322,13 +331,20 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 	//Overrides FeatureGroup.onAdd
 	onAdd: function (map) {
 		this._map = map;
+		var i, l, layer;
 
 		if (!this._gridClusters) {
 			this._generateInitialClusters();
 		}
 
-		for (var i = 0, l = this._needsClustering.length; i < l; i++) {
-			var layer = this._needsClustering[i];
+		for (i = 0, l = this._needsRemoving.length; i < l; i++) {
+			layer = this._needsRemoving[i];
+			this._removeLayer(layer);
+		}
+		this._needsRemoving = [];
+
+		for (i = 0, l = this._needsClustering.length; i < l; i++) {
+			layer = this._needsClustering[i];
 			if (layer.__parent) {
 				continue;
 			}
@@ -336,6 +352,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 		}
 		this._needsClustering = [];
 
+
 		this._map.on('zoomend', this._zoomEnd, this);
 		this._map.on('moveend', this._moveEnd, this);
 
@@ -384,7 +401,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 		for (var i = anArray.length - 1; i >= 0; i--) {
 			if (anArray[i] === obj) {
 				anArray.splice(i, 1);
-				return;
+				return true;
 			}
 		}
 	},
diff --git a/dist/leaflet.markercluster.js b/dist/leaflet.markercluster.js
index a6f110f..348661e 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(){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),L.FeatureGroup.pr [...]
\ No newline at end of file
+(function(){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),L.FeatureGroup.pr [...]
\ 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