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

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:29 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 f65634943f93fbcaaff2f0db969bd10469a0f491
Author: danzel <danzel at localhost.geek.nz>
Date:   Mon Sep 3 10:35:13 2012 +1200

    Update build.
---
 dist/leaflet.markercluster-src.js | 25 ++++++++++++++++++++++---
 dist/leaflet.markercluster.js     |  2 +-
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/dist/leaflet.markercluster-src.js b/dist/leaflet.markercluster-src.js
index adc2fb3..a871114 100644
--- a/dist/leaflet.markercluster-src.js
+++ b/dist/leaflet.markercluster-src.js
@@ -21,7 +21,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 		zoomToBoundsOnClick: true,
 		singleMarkerMode: false,
 
-		disableClusteringAtZoom: null
+		disableClusteringAtZoom: null,
+
+		skipDuplicateAddTesting: false
 	},
 
 	initialize: function (options) {
@@ -40,8 +42,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 
 	addLayer: function (layer) {
 
-		if (layer instanceof L.LayerGroup)
-		{
+		if (layer instanceof L.LayerGroup) {
 			for (var i in layer._layers) {
 				if (layer._layers.hasOwnProperty(i)) {
 					this.addLayer(layer._layers[i]);
@@ -66,6 +67,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 			return this;
 		}
 
+		if (!this.options.skipDuplicateAddTesting && this.hasLayer(layer)) {
+			return this;
+		}
+
 		//If we have already clustered we'll need to add this one to a cluster
 
 		if (this._unspiderfy) {
@@ -117,6 +122,20 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 		return this;
 	},
 
+	hasLayer: function (layer) {
+		var res = false;
+
+		this._topClusterLevel._recursively(new L.LatLngBounds([layer.getLatLng()]), 0, this._map.getMaxZoom() + 1,
+			function (cluster) {
+				for (var i = cluster._markers.length - 1; i >= 0 && !res; i--) {
+					if (cluster._markers[i] === layer) {
+						res = true;
+					}
+				}
+			}, null);
+		return res;
+	},
+
 	//Overrides FeatureGroup.onAdd
 	onAdd: function (map) {
 		L.FeatureGroup.prototype.onAdd.call(this, map);
diff --git a/dist/leaflet.markercluster.js b/dist/leaflet.markercluster.js
index cd89c81..c119720 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},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._currentSho [...]
\ 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},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

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