mapbox / mapbox-maps-ios

Interactive, thoroughly customizable maps for iOS powered by vector tiles and Metal
https://www.mapbox.com/mapbox-mobile-sdk
Other
475 stars 153 forks source link

MapboxMap and Snapshotter camera(for:padding:bearing:pitch:) methods don't set padding #2165

Open marcoboerner opened 6 months ago

marcoboerner commented 6 months ago

Environment

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.

persidskiy commented 5 months ago

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.

marcoboerner commented 5 months ago

@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.

persidskiy commented 5 months ago

@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