summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielamitaysc <daniel.amitay@snapchat.com>2017-07-24 15:32:39 -0400
committerJason Wray <jason@mapbox.com>2017-07-27 16:21:42 -0400
commit644b091ccd6fa2efb6cd81c109975a46483e1b8b (patch)
tree98ecd3291271a0d63e93cae27c35445c8c6f141b
parentfa0b307680aa47537e04f48134c8a38c2cb7e17c (diff)
downloadqtlocation-mapboxgl-644b091ccd6fa2efb6cd81c109975a46483e1b8b.tar.gz
[ios] Proper limiting behavior when trying to zoom out fully
-rw-r--r--platform/ios/src/MGLMapView.mm9
1 files changed, 3 insertions, 6 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 2de1496998..f026d6c1fe 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -1298,9 +1298,8 @@ public:
else if (pinch.state == UIGestureRecognizerStateChanged)
{
CGFloat newScale = self.scale * pinch.scale;
- double zoom = log2(newScale);
- if (zoom < _mbglMap->getMinZoom()) return;
-
+ double zoom = MAX(log2(newScale), _mbglMap->getMinZoom());
+
// Calculates the final camera zoom, has no effect within current map camera.
MGLMapCamera *toCamera = [self cameraByZoomingToZoomLevel:zoom aroundAnchorPoint:centerPoint];
@@ -1655,9 +1654,7 @@ public:
{
CGFloat distance = [quickZoom locationInView:quickZoom.view].y - self.quickZoomStart;
- CGFloat newZoom = log2f(self.scale) + (distance / 75);
-
- if (newZoom < _mbglMap->getMinZoom()) return;
+ CGFloat newZoom = MAX(log2f(self.scale) + (distance / 75), _mbglMap->getMinZoom());
CGPoint centerPoint = [self anchorPointForGesture:quickZoom];