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

Refactor unrotation #3588

Merged
merged 2 commits into from
Jan 18, 2016
Merged

Refactor unrotation #3588

merged 2 commits into from
Jan 18, 2016

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Jan 16, 2016

This PR refactors unrotation on iOS. There are two flavors of unrotation:

  • At low zoom levels (below z3), the map unrotates to avoid showing too much emptiness in polar regions. However, this unrotation should only occur due to a gesture by the user, not due to the developer rotating the map programmatically (compare with MapKit).
  • When the map is rotated within 7° of true north, the map unrotates for aesthetic reasons. However, this unrotation should only occur due to a gesture by the user, not due to programmatic rotation or an automatic rotation in heading or course tracking mode. We should avoid extraneous unrotation because it kicks the user out of heading or course tracking mode.

Fixes #3587.

/cc @friedbunny

@1ec5 1ec5 added bug iOS Mapbox Maps SDK for iOS labels Jan 16, 2016
@1ec5 1ec5 self-assigned this Jan 16, 2016
@1ec5 1ec5 added this to the ios-v3.1.0 milestone Jan 16, 2016
Avoid unrotating due to programmatic rotation, even programmatic rotation that might expose empty portions of the map. Only snap to north due to a gesture.
@1ec5 1ec5 changed the title Avoid unrotating in heading or course tracking mode Refactor unrotation Jan 17, 2016
if ((self.direction < MGLToleranceForSnappingToNorth
|| self.direction > 360 - MGLToleranceForSnappingToNorth)
&& self.userTrackingMode != MGLUserTrackingModeFollowWithHeading
&& self.userTrackingMode != MGLUserTrackingModeFollowWithCourse)
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch. I was initially unsure about needing to check for the tracking mode here, but two-finger zoom and quickzoom both require it.

@friedbunny
Copy link
Contributor

Thanks! 👌

@1ec5 1ec5 merged commit cb126ea into master Jan 18, 2016
@1ec5 1ec5 removed the ready label Jan 18, 2016
@1ec5 1ec5 deleted the 1ec5-keep-north-3587 branch January 18, 2016 19:42
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 refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants