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

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

Merged
merged 1 commit into from
Dec 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3027,6 +3027,8 @@ - (BOOL)isRotationAllowed
//
- (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;
Expand Down Expand Up @@ -3057,6 +3059,10 @@ - (void)unrotateIfNeededAnimated:(BOOL)animated
[self resetNorthAnimated:NO];
}
}
else if (self.direction < snapTolerance || self.direction > 360 - snapTolerance)
{
[self resetNorthAnimated:animated];
}
}

- (void)notifyMapChange:(mbgl::MapChange)change
Expand Down