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 easeTo interpolation on pitched maps #4540

Merged
merged 7 commits into from
Apr 18, 2017
Merged

Fix easeTo interpolation on pitched maps #4540

merged 7 commits into from
Apr 18, 2017

Conversation

mourner
Copy link
Member

@mourner mourner commented Apr 4, 2017

A PR in place of #4320. Should close #4178 and #3112.

Changes easeTo implementation to have more robust interpolation, fixing weird behavior on pitched maps, making it more consistent with flyTo, and makes the definition of offset less ambiguous.

Haven't updated expected values in the camera tests, but otherwise this is ready for review.

cc @joswinter

Launch Checklist

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • document any changes to public APIs
  • post benchmark scores
  • manually test the debug page

@mourner mourner requested a review from jfirebaugh April 4, 2017 18:20
@1ec5 1ec5 self-assigned this Apr 4, 2017
@mourner
Copy link
Member Author

mourner commented Apr 7, 2017

This turned out to be more complicated than I thought. We can't simply interpolate linearly through projected center because e.g. as you zoom in to a non-centered point, the scale increases exponentially while map center interpolates linearly, leading to a curved animation.

@mourner
Copy link
Member Author

mourner commented Apr 14, 2017

OK, I think I finally got this right, with proper offset handling, and the tests pass. The easing while zooming interpolation formula is still probably not 100% scientifically correct, but it works well in practice, and me and @anandthakker couldn't come up with anything better.

I'd like to improve the easing code further as there is still some logic duplication going on between easeTo and flyTo, but I'd rather do that in a follow-up PR.

@mourner
Copy link
Member Author

mourner commented Apr 27, 2017

@1ec5 should this be ported to native? It changes the way easeTo animations are calculated quite substantially.

@1ec5
Copy link
Contributor

1ec5 commented Apr 27, 2017

The native implementation of easeTo diverged from the GL JS implementation shortly after I ported it, but we probably do have to revisit the native implementation in light of mapbox/mapbox-gl-native#5292.

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.

easeTo goes in the wrong direction
3 participants