[ios] snap to north if interaction ends within ±7°

First proposed in #938, implemented in #1059, reverted in #1064.
This commit is contained in:
Jason Wray
2015-12-23 14:40:24 -05:00
parent d2b2336a9e
commit e4d8494852
2 changed files with 7 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ Known issues:
- MGLMapCamera’s `altitude` values now match those of MKMapCamera. ([#3362](https://github.com/mapbox/mapbox-gl-native/pull/3362))
- The user dot’s callout view is now centered above the user dot. It was previously offset slightly to the left. ([#3261](https://github.com/mapbox/mapbox-gl-native/pull/3261))
- Fixed an issue with small map views not properly fitting annotations within bounds. (#[3407](https://github.com/mapbox/mapbox-gl-native/pull/3407))
- The map will now snap to north. ([#3403](https://github.com/mapbox/mapbox-gl-native/pull/3403))
## iOS 3.0.1

View File

@@ -3027,6 +3027,8 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
//
- (void)unrotateIfNeededAnimated:(BOOL)animated
{
double snapTolerance = 7;
// don't worry about it in the midst of pinch or rotate gestures
//
if (self.pinch.state == UIGestureRecognizerStateChanged || self.rotate.state == UIGestureRecognizerStateChanged) return;
@@ -3057,6 +3059,10 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
[self resetNorthAnimated:NO];
}
}
else if (self.direction < snapTolerance || self.direction > 360 - snapTolerance)
{
[self resetNorthAnimated:animated];
}
}
- (void)notifyMapChange:(mbgl::MapChange)change