[Pkg-javascript-commits] [leaflet-markercluster] 172/479: Update build
Jonas Smedegaard
dr at jones.dk
Thu Oct 16 16:00:26 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 439394c1d87fc362b6aba59a6b722415875d20c5
Author: danzel <danzel at localhost.geek.nz>
Date: Mon Aug 20 10:19:40 2012 +1200
Update build
---
dist/leaflet.markercluster-src.js | 47 ++++++++++++++++++++++++++-------------
dist/leaflet.markercluster.js | 2 +-
2 files changed, 32 insertions(+), 17 deletions(-)
diff --git a/dist/leaflet.markercluster-src.js b/dist/leaflet.markercluster-src.js
index c83c283..8487a74 100644
--- a/dist/leaflet.markercluster-src.js
+++ b/dist/leaflet.markercluster-src.js
@@ -18,7 +18,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
spiderfyOnMaxZoom: true,
showCoverageOnHover: true,
- zoomToBoundsOnClick: true
+ zoomToBoundsOnClick: true,
+
+ disableClusteringAtZoom: null
},
initialize: function (options) {
@@ -228,6 +230,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
maxZoom = this._map.getMaxZoom(),
currentZoom = this._map.getZoom();
+ if (this.options.disableClusteringAtZoom) {
+ maxZoom = this.options.disableClusteringAtZoom - 1;
+ }
+
//console.time('cluster');
this._topClusterLevel = this._clusterToMarkerCluster(this._needsClustering, maxZoom);
this._needsClustering = [];
@@ -647,9 +653,11 @@ L.MarkerCluster = L.Marker.extend({
// false: wasn't able to put this marker in
// a MarkerCluster: the visible parent of the marker
_recursivelyAddLayer: function (layer, zoom) {
- var map = this._group._map,
- maxClusterRadius = this._group.options.maxClusterRadius,
+ var group = this._group,
+ map = group._map,
+ maxClusterRadius = group.options.maxClusterRadius,
result = false,
+ sqDist = this._group._sqDist,
i;
for (i = this._childClusters.length - 1; i >= 0; i--) {
@@ -667,21 +675,23 @@ L.MarkerCluster = L.Marker.extend({
//Couldn't add it to a child, but it should be part of us (this._zoom -> we are the root node)
if (!result && (this._canAcceptPosition(layer.getLatLng(), zoom) || ('_zoom' in this))) {
- //Add to ourself instead
- var layerPos = map.project(layer.getLatLng(), zoom + 1),
- sqDist = this._group._sqDist;
-
- //var distanceGrid = new L.DistanceGrid(maxClusterRadius);
- for (i = this._markers.length - 1; i >= 0; i--) {
- var m = this._markers[i];
- if (sqDist(layerPos, map.project(m.getLatLng(), zoom + 1)) < (maxClusterRadius * maxClusterRadius)) {
- result = m;
- this._markers.splice(i, 1);
- this._childCount--;
- break;
+ //If we are allowed to cluster at our childs level
+ if (zoom + 1 !== group.options.disableClusteringAtZoom) {
+
+ //Add to ourself instead
+ var layerPos = map.project(layer.getLatLng(), zoom + 1);
+
+ //var distanceGrid = new L.DistanceGrid(maxClusterRadius);
+ for (i = this._markers.length - 1; i >= 0; i--) {
+ var m = this._markers[i];
+ if (sqDist(layerPos, map.project(m.getLatLng(), zoom + 1)) < (maxClusterRadius * maxClusterRadius)) {
+ result = m;
+ this._markers.splice(i, 1);
+ this._childCount--;
+ break;
+ }
}
}
-
//result = distanceGrid.getNearObject(map.project(layer.getLatLng(), zoom + 1));
if (result) {
@@ -698,6 +708,11 @@ L.MarkerCluster = L.Marker.extend({
maxZoom = map.getMaxZoom(),
newResult,
finalResult = (zoom === wantedZoom) ? result : true;
+
+ if (group.options.disableClusteringAtZoom) {
+ maxZoom = group.options.disableClusteringAtZoom - 2;
+ }
+
while (zoom < maxZoom) {
zoom++;
diff --git a/dist/leaflet.markercluster.js b/dist/leaflet.markercluster.js
index 079f09f..0e4ccdc 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},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:80,iconCreateFunction:null,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0,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._currentShownBounds=null},addLa [...]
\ 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