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 pan drift with non-zero bearing #99

Merged
merged 1 commit into from
Feb 12, 2021
Merged

Fix pan drift with non-zero bearing #99

merged 1 commit into from
Feb 12, 2021

Conversation

macdrevx
Copy link
Contributor

Pull request checklist:

  • Briefly describe the changes in this PR.
  • Write tests for all new functionality. If tests were not written, please explain why.
  • Add an entry inside this element for inclusion in the mapbox-maps-ios changelog: <changelog>Fixed: Pan drift did not work correctly when bearing was non-zero.</changelog>.

Summary of changes

  • The directionality of the antimeridian correction was being calculated under the assumption that the bearing was 0. With a non-zero bearing, we need to instead consider the component of the offset vector that runs due east.

@macdrevx macdrevx added the bug 🪲 Something is broken! label Feb 12, 2021
Copy link
Contributor

@neelmistry94 neelmistry94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran the unit tests and on sim and things look good. This is a nice fix.

One open question up using wrap()

// cameraView.centerCoordinate is allowed to exceed [-180, 180]
// so that core animation interpolation works correctly when
// crossing the antimeridian. We wrap here to hide that implementation
// detail when accessing centerCoordinate via BaseMapView
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Thanks

- The directionality of the antimeridian correction was being calculated
  under the assumption that the bearing was 0. With a non-zero bearing,
  we need to instead consider the component of the offset that runs due
  east.
@macdrevx macdrevx merged commit e70ce89 into main Feb 12, 2021
@macdrevx macdrevx deleted the ah/fix-pan-drift branch February 12, 2021 17:25
persidskiy added a commit that referenced this pull request Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something is broken!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants