MapboxMap and Snapshotter camera(for:padding:bearing:pitch:) methods don't set padding
Environment
- Xcode version: 15.3
- iOS version: 16.x, 17.x
- Maps SDK Version: 11.3.0
Observed behavior and steps to reproduce
When using the camera(for:padding:bearing:pitch:) Methods of MapboxMap or Snapshotter, the padding in the CameraOptions is always nil.
Expected behavior
The padding should not be nil if it has been set with these methods.
Notes / preliminary analysis
As a workaround, when setting the padding property manually after creating the CameraOptions, everything works as intended.
Hi, if you are using this method, it is deperecated now as it was quite counter-intuitive https://docs.mapbox.com/ios/maps/api/11.3.0/documentation/mapboxmaps/mapboxmap/camera(for:padding:bearing:pitch:)-5juqy
If you want the resulting camera to have the specific padding, use this method https://docs.mapbox.com/ios/maps/api/11.3.0/documentation/mapboxmaps/mapboxmap/camera(for:camera:coordinatespadding:maxzoom:offset:)
let camera = map.camera(for:coordinates, camera: CameraOptions(padding: ..desired padding here))
Note: The coordinatesPadding parameter is different to camera.padding.
@persidskiy I did change this for the MapboxMap methods and it works.However, the Snapshotter doesn't have those new methods yet, but the same issue exists. In this case, it only works when we set the padding on the CameraOptions object manually again after creating it.
@marcoboerner Thank you for reporting this, the method should be available in Snapshotter too.
Internal ticket to track: https://mapbox.atlassian.net/browse/MAPSIOS-1323