Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

MGLMapView.camera.heading goes negative when rotating to face northwest #7723

Closed
1ec5 opened this issue Jan 14, 2017 · 2 comments
Closed

MGLMapView.camera.heading goes negative when rotating to face northwest #7723

1ec5 opened this issue Jan 14, 2017 · 2 comments
Assignees
Labels
bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS navigation For the Mapbox Navigation SDK for Android or iOS or navigation use cases in general
Milestone

Comments

@1ec5
Copy link
Contributor

1ec5 commented Jan 14, 2017

When you rotate an MGLMapView so that it faces anywhere between due north and due west, exclusive, its direction property is wrapped to between 0° and 360°, but its camera’s heading goes negative, indicating an invalid direction according to CLLocationDirection semantics. Therefore, if you then set the camera property of any map view to that MGLMapCamera, you wind up facing the wrong direction.

This regression was introduced in #4790 but was not addressed by df0d118.

/cc @incanus @friedbunny

@1ec5 1ec5 added bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS labels Jan 14, 2017
@1ec5 1ec5 added this to the ios-3.4.1 milestone Jan 14, 2017
@1ec5 1ec5 self-assigned this Jan 14, 2017
@1ec5
Copy link
Contributor Author

1ec5 commented Jan 14, 2017

-[MGLMapCamera isEqual:] (correctly) accounts for the heading without wrapping, and methods like -[MGLMapView setCamera:withDuration:animationTimingFunction:completionHandler:] bail if the current and new MGLMapCamera objects are identical. Therefore, I believe this regression could be a minor contributing factor to #7236 and #7723.

I say minor because the main code path that would be affected, through -didUpdateLocationSignificantlyAnimated:, would normally require the center coordinate to change significantly. So if there are any redundant calls to this method, this issue would indeed contribute to the problem, but the root cause still lies elsewhere.

@1ec5 1ec5 added the navigation For the Mapbox Navigation SDK for Android or iOS or navigation use cases in general label Jan 14, 2017
@1ec5
Copy link
Contributor Author

1ec5 commented Jan 24, 2017

Fixed in #7724 on the release-ios-v3.4.0 branch.

@1ec5 1ec5 closed this as completed Jan 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS navigation For the Mapbox Navigation SDK for Android or iOS or navigation use cases in general
Projects
None yet
Development

No branches or pull requests

1 participant