summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandar Stojiljkovic <aleksandar.stojiljkovic@mapbox.com>2019-07-11 00:28:57 +0300
committerAleksandar Stojiljkovic <aleksandar.stojiljkovic@mapbox.com>2019-07-23 07:16:43 +0300
commit0cf8fcbfda14a265770337a8d7abb159fc3298fa (patch)
tree138eeec821246427f6cabb734c405a11dcfa7095
parentb791a857920d9570b72d8acb0d7791267a113441 (diff)
downloadqtlocation-mapboxgl-0cf8fcbfda14a265770337a8d7abb159fc3298fa.tar.gz
[ios][macos] Fix center coordinate incorrect after pinch gesture
To changelog: Fixed incorrect center coordinate after pinch regression caused by edge insets fix (#14664). While working on #14664, missed to understand the logic used in ``` CLLocationCoordinate2D centerCoordinate = _previousPinchCenterCoordinate; mbgl::EdgeInsets padding { centerPoint.y, centerPoint.x, self.size.height - centerPoint.y, self.size.width - centerPoint.x }; self.mbglMap.jumpTo(mbgl::CameraOptions() .withCenter(MGLLatLngFromLocationCoordinate2D(centerCoordinate)) .withPadding(padding)); ``` Replacing this code by moveBy achieves the required translation. Fixes: #14977, #15082
-rw-r--r--platform/ios/src/MGLMapView.mm12
1 files changed, 4 insertions, 8 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 85a2e3be92..72ea8fac3d 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -297,8 +297,8 @@ public:
NSInteger _changeDelimiterSuppressionDepth;
- /// Center coordinate of the pinch gesture on the previous iteration of the gesture.
- CLLocationCoordinate2D _previousPinchCenterCoordinate;
+ /// Center of the pinch gesture on the previous iteration of the gesture.
+ CGPoint _previousPinchCenterPoint;
NSUInteger _previousPinchNumberOfTouches;
CLLocationDistance _distanceFromOldUserLocation;
@@ -1679,11 +1679,7 @@ public:
// meaningless.
if (self.userTrackingMode == MGLUserTrackingModeNone && pinch.numberOfTouches == _previousPinchNumberOfTouches)
{
- CLLocationCoordinate2D centerCoordinate = _previousPinchCenterCoordinate;
- mbgl::EdgeInsets padding { centerPoint.y, centerPoint.x, self.size.height - centerPoint.y, self.size.width - centerPoint.x };
- self.mbglMap.jumpTo(mbgl::CameraOptions()
- .withCenter(MGLLatLngFromLocationCoordinate2D(centerCoordinate))
- .withPadding(padding));
+ self.mbglMap.moveBy({centerPoint.x - _previousPinchCenterPoint.x, centerPoint.y - _previousPinchCenterPoint.y});
}
}
[self cameraIsChanging];
@@ -1741,7 +1737,7 @@ public:
[self unrotateIfNeededForGesture];
}
- _previousPinchCenterCoordinate = [self convertPoint:centerPoint toCoordinateFromView:self];
+ _previousPinchCenterPoint = centerPoint;
_previousPinchNumberOfTouches = pinch.numberOfTouches;
}