|
@@ -41,7 +41,20 @@ export const clusterMarkers = (markers: ItemSeries[], currentZoom: number, setCl
|
|
turf.point([+marker.pointJSON[1], +marker.pointJSON[0]], { ...marker })
|
|
turf.point([+marker.pointJSON[1], +marker.pointJSON[0]], { ...marker })
|
|
));
|
|
));
|
|
|
|
|
|
- const distance = currentZoom < 7 ? 280 : currentZoom < 9 ? 100 : 35;
|
|
|
|
|
|
+ let distance = 0;
|
|
|
|
+ switch (true) {
|
|
|
|
+ case (currentZoom < 7):
|
|
|
|
+ distance = 280;
|
|
|
|
+ break;
|
|
|
|
+ case (currentZoom < 9):
|
|
|
|
+ distance = 100;
|
|
|
|
+ break;
|
|
|
|
+ case (currentZoom < 13):
|
|
|
|
+ distance = 35;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ distance = 0;
|
|
|
|
+ }
|
|
const maxDistance = Math.max(0.1, distance * Math.pow(0.5, currentZoom / 2));
|
|
const maxDistance = Math.max(0.1, distance * Math.pow(0.5, currentZoom / 2));
|
|
|
|
|
|
const clustered = turf.clustersDbscan(points, maxDistance, { minPoints: 11 });
|
|
const clustered = turf.clustersDbscan(points, maxDistance, { minPoints: 11 });
|