From da9af96bcb6a3e35b67a2b81e9f5e2fe12484ed3 Mon Sep 17 00:00:00 2001 From: Philippe Cheype Date: Wed, 8 Dec 2021 13:09:15 +0100 Subject: [PATCH] Fix: rolled back bbox from static values to a dynamic getBound() --- src/algorithms/supercluster.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/algorithms/supercluster.ts b/src/algorithms/supercluster.ts index 34ae92b3..bfed5a9e 100644 --- a/src/algorithms/supercluster.ts +++ b/src/algorithms/supercluster.ts @@ -92,8 +92,10 @@ export class SuperClusterAlgorithm extends AbstractAlgorithm { } public cluster({ map }: AlgorithmInput): Cluster[] { + const { west, south, east, north } = map.getBounds().toJSON(); + return this.superCluster - .getClusters([-180, -90, 180, 90], Math.round(map.getZoom())) + .getClusters([west, south, east, north], Math.round(map.getZoom())) .map(this.transformCluster.bind(this)); }