[Pkg-javascript-commits] [leaflet-markercluster] 390/479: Update build
Jonas Smedegaard
dr at jones.dk
Thu Oct 16 16:01:00 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 e0d4b996229dc8aef5514272f2c90fd61aae0e60
Author: danzel <danzel at localhost.geek.nz>
Date: Sat Jun 22 10:47:22 2013 +1200
Update build
---
dist/leaflet.markercluster-src.js | 64 +++++++++++++++++++++++++++------------
dist/leaflet.markercluster.js | 2 +-
2 files changed, 46 insertions(+), 20 deletions(-)
diff --git a/dist/leaflet.markercluster-src.js b/dist/leaflet.markercluster-src.js
index 1907df7..ddc54db 100644
--- a/dist/leaflet.markercluster-src.js
+++ b/dist/leaflet.markercluster-src.js
@@ -45,6 +45,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
this._featureGroup = L.featureGroup();
this._featureGroup.on(L.FeatureGroup.EVENTS, this._propagateEvent, this);
+ this._nonPointGroup = L.featureGroup();
+ this._nonPointGroup.on(L.FeatureGroup.EVENTS, this._propagateEvent, this);
+
this._inZoomAnimation = 0;
this._needsClustering = [];
this._needsRemoving = []; //Markers removed while we aren't on the map need to be kept track of
@@ -62,6 +65,12 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
return this.addLayers(array);
}
+ //Don't cluster non point data
+ if (!layer.getLatLng) {
+ this._nonPointGroup.addLayer(layer);
+ return this;
+ }
+
if (!this._map) {
this._needsClustering.push(layer);
return this;
@@ -71,6 +80,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
return this;
}
+
//If we have already clustered we'll need to add this one to a cluster
if (this._unspiderfy) {
@@ -100,9 +110,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
removeLayer: function (layer) {
- //If the layer doesn't have a getLatLng then we can't cluster it, so add it to our child featureGroup
+ //Non point layers
if (!layer.getLatLng) {
- this._featureGroup.removeLayer(layer);
+ this._nonPointGroup.removeLayer(layer);
return this;
}
@@ -138,19 +148,16 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Takes an array of markers and adds them in bulk
addLayers: function (layersArray) {
var i, l, m,
- fg = this._featureGroup;
-
- if (!this._map) {
- this._needsClustering = this._needsClustering.concat(layersArray);
- return this;
- }
+ onMap = this._map,
+ fg = this._featureGroup,
+ npg = this._nonPointGroup;
for (i = 0, l = layersArray.length; i < l; i++) {
m = layersArray[i];
//Not point data, can't be clustered
if (!m.getLatLng) {
- fg.addLayer(m);
+ npg.addLayer(m);
continue;
}
@@ -158,6 +165,11 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
continue;
}
+ if (!onMap) {
+ this._needsClustering.push(m);
+ continue;
+ }
+
this._addLayer(m, this._maxZoom);
//If we just made a cluster of size 2 then we need to remove the other marker from the map (if it is) or we never will
@@ -170,14 +182,16 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
}
}
- //Update the icons of all those visible clusters that were affected
- fg.eachLayer(function (c) {
- if (c instanceof L.MarkerCluster && c._iconNeedsUpdate) {
- c._updateIcon();
- }
- });
+ if (onMap) {
+ //Update the icons of all those visible clusters that were affected
+ fg.eachLayer(function (c) {
+ if (c instanceof L.MarkerCluster && c._iconNeedsUpdate) {
+ c._updateIcon();
+ }
+ });
- this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
+ this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
+ }
return this;
},
@@ -185,11 +199,14 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Takes an array of markers and removes them in bulk
removeLayers: function (layersArray) {
var i, l, m,
- fg = this._featureGroup;
+ fg = this._featureGroup,
+ npg = this._nonPointGroup;
if (!this._map) {
for (i = 0, l = layersArray.length; i < l; i++) {
- this._arraySplice(this._needsClustering, layersArray[i]);
+ m = layersArray[i];
+ this._arraySplice(this._needsClustering, m);
+ npg.removeLayer(m);
}
return this;
}
@@ -198,6 +215,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
m = layersArray[i];
if (!m.__parent) {
+ npg.removeLayer(m);
continue;
}
@@ -240,6 +258,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Remove all the visible layers
this._featureGroup.clearLayers();
+ this._nonPointGroup.clearLayers();
this.eachLayer(function (marker) {
delete marker.__parent;
@@ -263,6 +282,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
bounds.extend(this._needsClustering[i].getLatLng());
}
}
+
+ bounds.extend(this._nonPointGroup.getBounds());
+
return bounds;
},
@@ -278,6 +300,8 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
for (i = markers.length - 1; i >= 0; i--) {
method.call(context, markers[i]);
}
+
+ this._nonPointGroup.eachLayer(method, context);
},
//Returns true if the given layer is in this MarkerClusterGroup
@@ -301,7 +325,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
}
}
- return !!(layer.__parent && layer.__parent._group === this);
+ return !!(layer.__parent && layer.__parent._group === this) || this._nonPointGroup.hasLayer(layer);
},
//Zoom down to show the given layer (spiderfying if necessary) then calls the callback
@@ -348,6 +372,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
var i, l, layer;
this._featureGroup.onAdd(map);
+ this._nonPointGroup.onAdd(map);
if (!this._gridClusters) {
this._generateInitialClusters();
@@ -413,6 +438,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Clean up all the layers we added to the map
this._featureGroup.onRemove(map);
+ this._nonPointGroup.onRemove(map);
this._map = null;
},
diff --git a/dist/leaflet.markercluster.js b/dist/leaflet.markercluster.js
index bef28b7..a593f8c 100644
--- a/dist/leaflet.markercluster.js
+++ b/dist/leaflet.markercluster.js
@@ -3,4 +3,4 @@
https://github.com/Leaflet/Leaflet.markercluster
(c) 2012-2013, Dave Leaver, smartrak
*/
-!function(t,e){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),this._featureG [...]
\ No newline at end of file
+!function(t,e){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),this._featureG [...]
\ 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