[ios] Maintain user tracking mode after orientation change

This commit is contained in:
Minh Nguyễn
2016-01-17 20:46:23 -08:00
committed by Minh Nguyễn
parent 251925568c
commit 867e01581c

View File

@@ -824,7 +824,8 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
// set content insets.
CLLocationCoordinate2D oldCenter = self.centerCoordinate;
self.contentInset = contentInsets;
self.centerCoordinate = oldCenter;
// Don’t call -setCenterCoordinate:, which resets the user tracking mode.
[self _setCenterCoordinate:oldCenter animated:NO];
}
}
@@ -1672,6 +1673,10 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
[self _setCenterCoordinate:centerCoordinate edgePadding:self.contentInset zoomLevel:zoomLevel direction:direction duration:animated ? MGLAnimationDuration : 0 animationTimingFunction:nil completionHandler:completion];
}
- (void)_setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate animated:(BOOL)animated {
[self _setCenterCoordinate:centerCoordinate edgePadding:self.contentInset zoomLevel:self.zoomLevel direction:self.direction duration:animated ? MGLAnimationDuration : 0 animationTimingFunction:nil completionHandler:NULL];
}
- (void)_setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate edgePadding:(UIEdgeInsets)insets zoomLevel:(double)zoomLevel direction:(CLLocationDirection)direction duration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion
{
_mbglMap->cancelTransitions();