mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-01 08:03:30 +02:00
_clusterOne should use cluster diameter for creating initial clusters rather than radius.
This commit is contained in:
@@ -131,14 +131,14 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
//Will return null or the new MarkerCluster. The clustered in marker is removed from the given array
|
//Will return null or the new MarkerCluster. The clustered in marker is removed from the given array
|
||||||
_clusterOne: function (unclusteredMarkers, newMarker, zoom) {
|
_clusterOne: function (unclusteredMarkers, newMarker, zoom) {
|
||||||
var markerPos = newMarker._projCenter || this._map.project(newMarker.getLatLng(), zoom),
|
var markerPos = newMarker._projCenter || this._map.project(newMarker.getLatLng(), zoom),
|
||||||
clusterRadiusSqrd = this.options.maxClusterRadius * this.options.maxClusterRadius,
|
clusterDiameterSqrd = 2 * this.options.maxClusterRadius * 2 * this.options.maxClusterRadius,
|
||||||
i, m, mPos;
|
i, m, mPos;
|
||||||
|
|
||||||
for (i = unclusteredMarkers.length - 1; i >= 0; i--) {
|
for (i = unclusteredMarkers.length - 1; i >= 0; i--) {
|
||||||
m = unclusteredMarkers[i];
|
m = unclusteredMarkers[i];
|
||||||
mPos = m._projCenter || this._map.project(m.getLatLng(), zoom);
|
mPos = m._projCenter || this._map.project(m.getLatLng(), zoom);
|
||||||
|
|
||||||
if (this._sqDist(markerPos, mPos) <= clusterRadiusSqrd) {
|
if (this._sqDist(markerPos, mPos) <= clusterDiameterSqrd) {
|
||||||
//Create a new cluster with these 2
|
//Create a new cluster with these 2
|
||||||
var newCluster = new L.MarkerCluster(this, m, newMarker);
|
var newCluster = new L.MarkerCluster(this, m, newMarker);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user