diff options
-rw-r--r-- | platform/ios/MGLMapView.mm | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index a3c25f267f..d486949175 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -48,7 +48,7 @@ NSString *const MGLDefaultStyleMarkerSymbolName = @"default_marker"; const NSTimeInterval MGLAnimationDuration = 0.3; const CGSize MGLAnnotationUpdateViewportOutset = {150, 150}; -const CGFloat MGLMinZoom = 3; +const CGFloat MGLMinimumZoom = 3; NSString *const MGLAnnotationIDKey = @"MGLAnnotationIDKey"; @@ -1131,7 +1131,7 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr; CGFloat duration = (animated ? MGLAnimationDuration : 0); mbglMap->setLatLngZoom(coordinateToLatLng(coordinate), - fmaxf(mbglMap->getZoom(), MGLMinZoom), + fmaxf(mbglMap->getZoom(), self.currentMinimumZoom), secondsAsDuration(duration)); [self notifyMapChange:@(animated ? mbgl::MapChangeRegionDidChangeAnimated : mbgl::MapChangeRegionDidChange)]; @@ -1172,7 +1172,7 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr; CGFloat duration = (animated ? MGLAnimationDuration : 0); mbglMap->setLatLngZoom(mbglMap->getLatLng(), - fmaxf(zoomLevel, MGLMinZoom), + fmaxf(zoomLevel, self.currentMinimumZoom), secondsAsDuration(duration)); [self unrotateIfNeededAnimated:animated]; @@ -1743,7 +1743,7 @@ CLLocationCoordinate2D latLngToCoordinate(mbgl::LatLng latLng) { self.showsUserLocation = YES; - if (self.zoomLevel < MGLMinZoom) [self setZoomLevel:MGLMinZoom animated:YES]; + if (self.zoomLevel < self.currentMinimumZoom) [self setZoomLevel:self.currentMinimumZoom animated:YES]; if (self.userLocationAnnotationView) { @@ -1952,9 +1952,14 @@ CLLocationCoordinate2D latLngToCoordinate(mbgl::LatLng latLng) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)), dispatch_get_main_queue(), animations); } +- (CGFloat)currentMinimumZoom +{ + return fmaxf(mbglMap->getMinZoom(), MGLMinimumZoom); +} + - (BOOL)isRotationAllowed { - return (self.zoomLevel > MGLMinZoom); + return (self.zoomLevel >= self.currentMinimumZoom); } // correct rotations to north as needed |