summaryrefslogtreecommitdiff
path: root/platform/ios/src/MGLMapView.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/ios/src/MGLMapView.mm')
-rw-r--r--platform/ios/src/MGLMapView.mm20
1 files changed, 7 insertions, 13 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index b4c9e9d2a7..5ae588d619 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -1264,7 +1264,7 @@ public:
{
[self trackGestureEvent:MGLEventGesturePinchStart forRecognizer:pinch];
- self.scale = _mbglMap->getScale();
+ self.scale = powf(2, _mbglMap->getZoom());
[self notifyGestureDidBegin];
}
@@ -1280,7 +1280,7 @@ public:
if (![self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)] ||
[self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:toCamera])
{
- _mbglMap->setScale(newScale, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y });
+ _mbglMap->setZoom(zoom, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y });
}
// The gesture recognizer only reports the gesture’s current center
// point, so use the previous center point to anchor the transition.
@@ -1338,7 +1338,7 @@ public:
} else {
if (drift)
{
- _mbglMap->setScale(newScale, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y }, MGLDurationFromTimeInterval(duration));
+ _mbglMap->setZoom(zoom, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y }, MGLDurationFromTimeInterval(duration));
}
}
@@ -1616,7 +1616,7 @@ public:
{
[self trackGestureEvent:MGLEventGestureQuickZoom forRecognizer:quickZoom];
- self.scale = _mbglMap->getScale();
+ self.scale = powf(2, _mbglMap->getZoom());
self.quickZoomStart = [quickZoom locationInView:quickZoom.view].y;
@@ -1633,18 +1633,12 @@ public:
CGPoint centerPoint = [self anchorPointForGesture:quickZoom];
MGLMapCamera *oldCamera = self.camera;
-
- double zoom = self.zoomLevel;
- double scale = powf(2, newZoom) / _mbglMap->getScale();
-
- double estimatedZoom = zoom * scale;
-
- MGLMapCamera *toCamera = [self cameraByZoomingToZoomLevel:estimatedZoom aroundAnchorPoint:centerPoint];
+ MGLMapCamera *toCamera = [self cameraByZoomingToZoomLevel:newZoom aroundAnchorPoint:centerPoint];
if (![self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)] ||
[self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:toCamera])
{
- _mbglMap->scaleBy(scale, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y });
+ _mbglMap->setZoom(newZoom, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y });
}
[self cameraIsChanging];
@@ -2407,7 +2401,7 @@ public:
{
centerPoint = self.userLocationAnnotationViewCenter;
}
- _mbglMap->scaleBy(scaleFactor, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y });
+ _mbglMap->setZoom(_mbglMap->getZoom() + log2(scaleFactor), mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y });
[self unrotateIfNeededForGesture];
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, self.accessibilityValue);