summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/ios/MGLMapView.mm14
1 files changed, 11 insertions, 3 deletions
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index 81ec18bb7c..3c4116c8d9 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -1555,7 +1555,7 @@ std::chrono::steady_clock::duration durationInSeconds(float duration)
- (void)resetNorthAnimated:(BOOL)animated
{
- _mbglMap->setBearing(0, durationInSeconds(animated ? MGLAnimationDuration : 0));
+ [self setDirection:0 animated:animated];
}
- (void)resetPosition
@@ -1782,10 +1782,18 @@ mbgl::LatLngBounds MGLLatLngBoundsFromCoordinateBounds(MGLCoordinateBounds coord
{
if ( ! animated && ! self.rotationAllowed) return;
- if (self.userTrackingMode == MGLUserTrackingModeFollowWithHeading)
+ if (self.userTrackingMode == MGLUserTrackingModeFollowWithHeading ||
+ self.userTrackingMode == MGLUserTrackingModeFollowWithCourse)
{
self.userTrackingMode = MGLUserTrackingModeFollow;
}
+
+ [self _setDirection:direction animated:animated];
+}
+
+- (void)_setDirection:(CLLocationDirection)direction animated:(BOOL)animated
+{
+ if (direction == self.direction) return;
CGFloat duration = animated ? MGLAnimationDuration : 0;
@@ -2818,7 +2826,7 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng)
if (headingDirection >= 0 && self.userTrackingMode == MGLUserTrackingModeFollowWithHeading)
{
- _mbglMap->setBearing(headingDirection, durationInSeconds(MGLAnimationDuration));
+ [self _setDirection:headingDirection animated:YES];
}
}