diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-11-17 16:52:19 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2015-11-18 11:27:17 -0800 |
commit | fcec19b8357e65d39d429a175001ef4fc1876686 (patch) | |
tree | 917c61d30e3c128606623c4f1387a418e1a51693 | |
parent | f0022e6e6f94d731d8e7e23d55d1baf80c6b25a9 (diff) | |
download | qtlocation-mapboxgl-fcec19b8357e65d39d429a175001ef4fc1876686.tar.gz |
Ensure proper will/is/didChange for resetNorth
-rw-r--r-- | platform/ios/MGLMapView.mm | 14 |
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]; } } |