Skip to content

Commit

Permalink
fix(supercluster): fixes inconsistent rounding causing clusters to no…
Browse files Browse the repository at this point in the history
…t decluster at maxZoom when using fractional zooming
  • Loading branch information
scarg0e committed Jun 21, 2024
1 parent c5cdf54 commit c2b5a99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/algorithms/supercluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class SuperClusterAlgorithm extends AbstractAlgorithm {

public calculate(input: AlgorithmInput): AlgorithmOutput {
let changed = false;
const state = { zoom: input.map.getZoom() };
const state = { zoom: Math.round(input.map.getZoom()) };

if (!equal(input.markers, this.markers)) {
changed = true;
Expand Down Expand Up @@ -91,7 +91,7 @@ export class SuperClusterAlgorithm extends AbstractAlgorithm {
return this.superCluster
.getClusters([-180, -90, 180, 90], Math.round(map.getZoom()))
.map((feature: ClusterFeature<{ marker: Marker }>) =>
this.transformCluster(feature)
this.transformCluster(feature),
);
}

Expand Down

0 comments on commit c2b5a99

Please sign in to comment.