googlemaps / googlemaps/js-markerclusterer
SuperClusterViewportAlgorithm at zoom 0-3 not working.
- Dominant language
- TypeScript
- Stars
- 293
- Forks
- 104
- Avg merge
- 3m
- Merged PRs (30d)
- 18
Description
It does not seem to render starting at zoom 4. But I need zoom 3 for the world view.
Does it somehow ignore/filter out or not get viewport at these zoom levels?
`new SuperClusterViewportAlgorithm({radius: 150, maxZoom: 16, viewportPadding: 50, minZoom: 3, minPoints: 5})`
It looks like the bounds are broken at zoom 3?
I resorted to temporary hack, but I assume something is not correct in the getPaddedViewport math:
```
class NewSuperClusterViewportAlgorithm extends SuperClusterViewportAlgorithm {
public cluster({ map, mapCanvasProjection }: AlgorithmInput): Cluster[] {
let state: SuperClusterViewportState;
if (map.getZoom() <= 3) {
state = {
zoom: Math.round(map.getZoom()),
view: [-180, -90, 180, 90]
};
} else {
state = {
zoom: Math.round(map.getZoom()),
view: getPaddedViewport(
map.getBounds(),
mapCanvasProjection,
this.viewportPadding
),
};
}
return this.superCluster
.getClusters(state.view, state.zoom)
.map((feature: ClusterFeature<{ marker: any }>) =>
this.transformCluster(feature)
);
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.