-
Notifications
You must be signed in to change notification settings - Fork 1.3k
.centerCoordinate incorrect after zoom gesture #14977
Comments
Hi! This bug turned up when we upgraded from 4.9 to 5.1 and I'm certain it wasn't there before. Also, I've only been able to reproduce on a physical device and not on a simulator. Maybe this is because the simulator doesn't pan and zoom in the same gesture as the physical device does? I've modified the SimpleMapViewExample_Swift class from the demo app to help demonstrate the issue:
|
Here's a video that demonstrates the issue using the code above: https://www.dropbox.com/s/k3sihajq5ojm1u0/mapbox_zoom_bug.mov?dl=0 |
I'm pretty sure issue #14192 is also related to that... |
Hi,
|
Similar to what you’re describing, @cbo1964, this issue also seems to be manifesting during any rotation 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
Incoming fix #15097 |
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
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
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
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
In v5.1, It looks the mapView.centerCoordinate is being set to the center of the two finger zoom gesture, rather than the center of the mapView. Panning with one finger does not cause an issue. The issue does not exist in v4.9 (did not test v5.0).
Steps to reproduce
Expected behavior
.centerCoordinate reports the center of the mapView after two finger zoom/pan
Actual behavior
.centerCoordinate appears to report the center two finger gesture as the .centerPoint on regionDidChange
Configuration
Mapbox v5.1
iOS 12.3.1 (MacOS 10.14.5)
iPad Air 2
Xcode 10.2.1
The text was updated successfully, but these errors were encountered: