[Pkg-javascript-commits] [leaflet-markercluster] 129/479: Update the build, hopefully that is all of the bugs for today :)

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 b7cc2bf5c472019884edd46951a2704fa5fa44aa
Author: danzel <danzel at localhost.geek.nz>
Date:   Fri Jul 27 16:00:42 2012 +1200

    Update the build, hopefully that is all of the bugs for today :)
---
 dist/leaflet.markercluster-src.js | 37 ++++++++++++++++++++++++++++++++++++-
 dist/leaflet.markercluster.js     |  2 +-
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/dist/leaflet.markercluster-src.js b/dist/leaflet.markercluster-src.js
index fd8ed3d..b5b845d 100644
--- a/dist/leaflet.markercluster-src.js
+++ b/dist/leaflet.markercluster-src.js
@@ -57,6 +57,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 	removeLayer: function (layer) {
 		if (this._unspiderfy) {
 			this._unspiderfy();
+			this._unspiderfyLayer(layer);
 		}
 
 		if (!this._topClusterLevel._recursivelyRemoveLayer(layer)) {
@@ -238,6 +239,8 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 			if (this._sqDist(markerPos, mPos) <= clusterDiameterSqrd) {
 				//Create a new cluster with these 2
 				var newCluster = new L.MarkerCluster(this, m, newMarker);
+				delete m._projCenter;
+				delete newMarker._projCenter;
 
 				unclusteredMarkers.splice(i, 1);
 				return newCluster;
@@ -269,6 +272,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 				c = clusters[j];
 				if (this._sqDist(point._projCenter, c._projCenter) <= clusterRadiusSqrd) {
 					c._addChild(point);
+					delete point._projCenter;
 					c._projCenter = this._map.project(c.getLatLng(), zoom);
 
 					used = true;
@@ -484,6 +488,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 
 				setTimeout(function () {
 					L.FeatureGroup.prototype.removeLayer.call(me, layer);
+					layer.setOpacity(1);
 
 					me._animationEnd();
 				}, 250);
@@ -1320,11 +1325,30 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
 		}
 
 		setTimeout(function () {
+			//If we have only <= one child left then that marker will be shown on the map so don't remove it!
+			var stillThereChildCount = 0;
 			for (i = childMarkers.length - 1; i >= 0; i--) {
 				m = childMarkers[i];
+				if (m._spiderLeg) {
+					stillThereChildCount++;
+				}
+			}
+
+
+			for (i = childMarkers.length - 1; i >= 0; i--) {
+				m = childMarkers[i];
+
+				if (!m._spiderLeg) { //Has already been unspiderfied
+					continue;
+				}
+
+
+				m.setOpacity(1);
 				m.setZIndexOffset(0);
 
-				L.FeatureGroup.prototype.removeLayer.call(group, m);
+				if (stillThereChildCount > 1) {
+					L.FeatureGroup.prototype.removeLayer.call(group, m);
+				}
 
 				map.removeLayer(m._spiderLeg);
 				delete m._spiderLeg;
@@ -1353,6 +1377,17 @@ L.MarkerClusterGroup.include({
 		if (this._spiderfied) {
 			this._spiderfied.unspiderfy();
 		}
+	},
+
+	//If the given layer is currently being spiderfied then we unspiderfy it so it isn't on the map anymore etc
+	_unspiderfyLayer: function (layer) {
+		if (layer._spiderLeg) {
+			L.FeatureGroup.prototype.removeLayer.call(this, layer);
+			layer.setOpacity(1);
+			layer.setZIndexOffset(0);
+			this._map.removeLayer(layer._spiderLeg);
+			delete layer._spiderLeg;
+		}
 	}
 });
 
diff --git a/dist/leaflet.markercluster.js b/dist/leaflet.markercluster.js
index 34c7b6d..ba8273b 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