mapbox-maps-ios icon indicating copy to clipboard operation
mapbox-maps-ios copied to clipboard

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

Open marcoboerner opened this issue 1 year ago • 3 comments

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.

marcoboerner avatar Apr 17 '24 13:04 marcoboerner

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 avatar Apr 22 '24 11:04 persidskiy

@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 avatar Apr 25 '24 08:04 marcoboerner

@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

persidskiy avatar Apr 25 '24 08:04 persidskiy