-
Notifications
You must be signed in to change notification settings - Fork 22
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
More dynamic UX for cluster click #423
Comments
I just noticed, I probably also need to change this in fetchClusters:
|
@wbazant Your suggested What this means is that the latitude, longitude of the cluster (what is returned by the API) is sufficient to determine the map bounds of the corresponding grid cell. The logic is worked out in https://github.com/falling-fruit/falling-fruit-api/blob/main/helpers.js, see |
That would be better, since the zoom heuristic also depends on the viewport - I was thinking zooming in by a factor of 3 will work when the cluster grid is at least 8x8 on the screen, as you point out that needs two tiles. I had a go at having your suggestion implemented by an AI assistant this morning, would you check 42f7793 ? The math seems legit - at least as a series of transformations, I didn't try to understand them, but I gave Claude your file and the requirements, and it came up with:
and then we unpacked the implementations of your functions. I also tested it a bit and it seems to zoom in quite sensibly. Returning the cluster bounds from the API would tie up with our proposed resolution for #378 and be much better for sparsely located locations! |
Neat, the AI did a good job refactoring my code! I simplified and added a comment, but the math was right. (a8da6cb) |
I think the live site works as proposed now, and when a cluster ends up splitting into several clusters it's very nice and dynamic - maybe the during the zoom-in the clusters could be made opaque that shows they're being discarded, instead of being just replaced. If I'm going after a small cluster I end up having to 'chase' it around the map. I'm not sure what to do about it but I'll keep the issue open for a bit more |
@wbazant Until I look into adding bounding boxes to the API's |
Zooming by 1 after a click results in slow, frustrating UX.
After playing around, zooming in by 3 (so into 1/8 of the original screen) seems to be just on the edge, sometimes it's slightly too far into the cluster (so we don't see all the dots corresponding to the cluster, just most of them) but mostly results in e.g. zooming into the right country or city.
Also, if there's just one location somewhere remote, we might as well zoom into it directly.
The formula for delta zoom given cluster count, how many other clusters there are near it, etc. could probably get very complicated if we wanted it to, but for now I'm proposing this:
The text was updated successfully, but these errors were encountered: