You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
The oldCamera and newCamera should have different center coordinates.
Actual behavior
They have the same center coordinate in -mapView:shouldChangeFromCamera:toCamera: .
The same behavior occurs with other gesture-based region changes. It looks like the new camera is being created with
(cameraByZoomingToZoomLevel:aroundAnchorPoint)[https://github.com/mapbox/mapbox-gl-native/blob/0ef7b7154f6d4498077a83db5c486c61bc34938c/platform/ios/src/MGLMapView.mm#L1867], but I am not sure whether also creates a center coordinate for the camera.
I explicitly set the new camera's center coordinate after cameraByZoomingToZoomLevel is called here and that seemed to fix the issue for the double tap. toCamera.centerCoordinate = [self convertPoint:anchorPoint toCoordinateFromView:self];
I explicitly set the new camera's center coordinate after cameraByZoomingToZoomLevel is called here and that seemed to fix the issue for the double tap. toCamera.centerCoordinate = [self convertPoint:anchorPoint toCoordinateFromView:self];
This assumes that the user double-taps on the center of the map view or spreads two fingers apart over the center. However, if the gesture isn’t centered on the map view, then this camera will be calculated as if the view were jumping to the gesture’s center instead of just being anchored there.
Platform: iOS
Mapbox SDK version: v3.7.0-beta.3
Steps to trigger behavior
-mapView:shouldChangeFromCamera:toCamera:
.centerCoordinate
of theoldCamera
andnewCamera
in-mapView:shouldChangeFromCamera:toCamera:
.Expected behavior
The
oldCamera
andnewCamera
should have different center coordinates.Actual behavior
They have the same center coordinate in
-mapView:shouldChangeFromCamera:toCamera:
.The same behavior occurs with other gesture-based region changes. It looks like the new camera is being created with
(
cameraByZoomingToZoomLevel:aroundAnchorPoint
)[https://github.com/mapbox/mapbox-gl-native/blob/0ef7b7154f6d4498077a83db5c486c61bc34938c/platform/ios/src/MGLMapView.mm#L1867], but I am not sure whether also creates a center coordinate for the camera.I explicitly set the new camera's center coordinate after
cameraByZoomingToZoomLevel
is called here and that seemed to fix the issue for the double tap.toCamera.centerCoordinate = [self convertPoint:anchorPoint toCoordinateFromView:self];
cc @fabian-guerra
The text was updated successfully, but these errors were encountered: