mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-26 08:03:51 +02:00
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...
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user