-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 flyTo not zooming to exact given zoom #6828
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, but I would maybe add a comment above the new conditional explaining why its there 👍
@andrewharvey great, I didn't realize that was already reported. @mollymerp I couldn't come up with a comment that would make the lines clearer... |
oh I was just thinking something like "avoid floating point errors by using zoom directly when (whatever k represents) |
…7222) (mapbox#7223) * Fix flyTo when final zoom is not requested one (mapbox#7222) This complete the fix for mapbox#6828 when the final zoom value is different from the zoom requested. * Fix final center position and add test case.
…7222) (mapbox#7223) * Fix flyTo when final zoom is not requested one (mapbox#7222) This complete the fix for mapbox#6828 when the final zoom value is different from the zoom requested. * Fix final center position and add test case.
…7222) (mapbox#7223) * Fix flyTo when final zoom is not requested one (mapbox#7222) This complete the fix for mapbox#6828 when the final zoom value is different from the zoom requested. * Fix final center position and add test case.
Currently, if you call
flyTo
with an integerzoom
, you're not guaranteed to land on the exact zoom after the animation because of floating point errors. E.g.map.flyTo({zoom: 2})
when starting on zoom 0.6 will end up on zoom1.999999999996
, which is problematic if you wish to get on the exact zoom for corresponding tiles to load. Discovered this while implementing thegetClusterExpansionZoom
API.Launch Checklist
document any changes to public APIspost benchmark scorescloses #6191