diff options
author | Jason Wray <jason@mapbox.com> | 2015-12-23 14:40:24 -0500 |
---|---|---|
committer | Jason Wray <jason@mapbox.com> | 2015-12-24 13:45:51 -0500 |
commit | e4d84948524844667c742d7d5e0b2c0c4295cde7 (patch) | |
tree | 57149e83f682165a3ea4a7f80e8aff96c799d20b /platform/ios | |
parent | d2b2336a9efc00978950cd3ee9d4d0af6ad7f1bf (diff) | |
download | qtlocation-mapboxgl-e4d84948524844667c742d7d5e0b2c0c4295cde7.tar.gz |
[ios] snap to north if interaction ends within ±7°
First proposed in #938, implemented in #1059, reverted in #1064.
Diffstat (limited to 'platform/ios')
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index af3adae6b1..5eee1d52ff 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -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 |