summaryrefslogtreecommitdiff
path: root/platform/ios/src/MGLMapView.mm
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2017-06-22 11:09:09 -0700
committerMinh Nguyễn <mxn@1ec5.org>2017-06-22 12:17:17 -0700
commiteedd0553b467bb82d5e2e928943beb12522d056c (patch)
treed748ca8098f63cf24827a30db5e952dbb6502ffc /platform/ios/src/MGLMapView.mm
parenta1c5b32da66a32e52e24163f826dabbc1e4d38bf (diff)
downloadqtlocation-mapboxgl-eedd0553b467bb82d5e2e928943beb12522d056c.tar.gz
[ios] Allow delegate to keep wandering pinch from panning map
MGLMapView consults MGLMapViewDelegate about whether to zoom the map in response to a pinch gesture, but it should also account for the delegate’s response when panning the map due to the pinch’s center point wandering. Fixes #9168.
Diffstat (limited to 'platform/ios/src/MGLMapView.mm')
-rw-r--r--platform/ios/src/MGLMapView.mm20
1 files changed, 10 insertions, 10 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 459eda19c8..ba37dc3d31 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -1306,16 +1306,16 @@ public:
[self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:toCamera])
{
_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.
- // If the number of touches has changed, the remembered center point is
- // meaningless.
- if (self.userTrackingMode == MGLUserTrackingModeNone && pinch.numberOfTouches == _previousPinchNumberOfTouches)
- {
- CLLocationCoordinate2D centerCoordinate = _previousPinchCenterCoordinate;
- _mbglMap->setLatLng(MGLLatLngFromLocationCoordinate2D(centerCoordinate),
- 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.
+ // If the number of touches has changed, the remembered center point is
+ // meaningless.
+ if (self.userTrackingMode == MGLUserTrackingModeNone && pinch.numberOfTouches == _previousPinchNumberOfTouches)
+ {
+ CLLocationCoordinate2D centerCoordinate = _previousPinchCenterCoordinate;
+ _mbglMap->setLatLng(MGLLatLngFromLocationCoordinate2D(centerCoordinate),
+ mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y });
+ }
}
[self cameraIsChanging];
}