diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-11-17 16:52:19 -0800 |
---|---|---|
committer | Justin R. Miller <incanus@codesorcery.net> | 2015-11-18 15:59:58 -0800 |
commit | fd0e21321e40d1bc503a1c2b6dadb677ea2c6940 (patch) | |
tree | 2c70f532210c7f3d1821534f2c706e3870858216 /platform | |
parent | 5b7866a1bab4b5dbbd2ccc46a6bee1785338467f (diff) | |
download | qtlocation-mapboxgl-fd0e21321e40d1bc503a1c2b6dadb677ea2c6940.tar.gz |
Ensure proper will/is/didChange for resetNorth
Diffstat (limited to 'platform')
-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 750f3fabbb..4c971c453b 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]; } } |