Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: supercluster max zoom with fractional zooming #887

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

scarg0e
Copy link

@scarg0e scarg0e commented Jun 21, 2024

Whether to re-cluster on zoom is determined by the fractional zoom value here:

if (this.state.zoom <= this.maxZoom || state.zoom <= this.maxZoom) {

however the clusters are calculated using a rounded integer value here:

.getClusters([-180, -90, 180, 90], Math.round(map.getZoom()))

This means if our new zoom value is fractionally above our maxZoom, it will be the final re-cluster on zooming in. However the clusters returned will not be de-clustered, as the rounded down value used for getClusters is not above our maxZoom, leaving our clusters not in the final de-clustered state even as we continue to zoom in.

Fixes #647 🦕

example of existing behaviour from issue 647:

maxZoom=14
zoom map to 14.2
getClusters called for zoom=14
zoom map to 16.2
getClusters not called
Result: will never decluster as getClusters is never called with a value above maxZoom

example of behavior with fix:

maxZoom=14
zoom map to 14.2
getClusters called for zoom=14
zoom map to 16.2
getClusters called for zoom=16
Result: does decluster as getClusters is called with a value above maxZoom

Copy link

google-cla bot commented Jun 21, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

…t decluster at maxZoom when using fractional zooming
@scarg0e scarg0e changed the title Fix supercluster max zoom with fractional zooming fix: supercluster max zoom with fractional zooming Jun 24, 2024
@lupus78
Copy link

lupus78 commented Aug 30, 2024

I just tracked down this issue, and found this PR. When is this going to be merged into a release?
IMHO, this is pretty big usability issue. It took me days to finally realize what the issue was.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SuperClusterAlgorithm keeps displaying cluster at maximum zoom level
2 participants