[Pkg-javascript-commits] [leaflet-markercluster] 93/479: Cluster everything up from the bottom. Makes clustering look visually pleasing and gets rid of artifacts from old clustering. Some dead code removal from this change next...
Jonas Smedegaard
dr at jones.dk
Thu Oct 16 16:00:14 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 2a0a62f3f0b45ee33a28104ef6ca2a2511c1dd31
Author: danzel <danzel at localhost.geek.nz>
Date: Tue Jul 24 16:12:27 2012 +1200
Cluster everything up from the bottom. Makes clustering look visually pleasing and gets rid of artifacts from old clustering. Some dead code removal from this change next...
---
src/MarkerClusterGroup.js | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 1d2f78a..3c9a1ad 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -60,23 +60,23 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
},
_generateInitialClusters: function () {
- var res = this._topClusterLevel = this._clusterToMarkerCluster(this._needsClustering, this._map.getZoom()),
- minZoom = this._map.getMinZoom();
+ var minZoom = this._map.getMinZoom(),
+ maxZoom = this._map.getMaxZoom(),
+ currentZoom = this._map.getZoom();
- //Generate 2 levels up if we can
- if (minZoom < this._topClusterLevel._zoom && this._topClusterLevel._childCount > 1) {
+ this._topClusterLevel = this._clusterToMarkerCluster(this._needsClustering, maxZoom);
+
+ //Generate to the top
+ while (minZoom < this._topClusterLevel._zoom) {
this._topClusterLevel = this._clusterToMarkerCluster(this._topClusterLevel._childClusters.concat(this._topClusterLevel._markers), this._topClusterLevel._zoom - 1);
- if (minZoom < this._topClusterLevel._zoom && this._topClusterLevel._childCount > 1) {
- this._topClusterLevel = this._clusterToMarkerCluster(this._topClusterLevel._childClusters.concat(this._topClusterLevel._markers), this._topClusterLevel._zoom - 1);
- }
}
//Remember the current zoom level and bounds
- this._zoom = this._map._zoom;
+ this._zoom = currentZoom;
this._currentShownBounds = this._getExpandedVisibleBounds();
//Make things appear on the map
- res._recursivelyAddChildrenToMap(null, 1, this._getExpandedVisibleBounds());
+ this._topClusterLevel._recursivelyAddChildrenToMap(null, currentZoom - minZoom + 1, this._currentShownBounds);
},
//Merge and split any existing clusters that are too big or small
--
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