mapbox-maps-flutter
mapbox-maps-flutter copied to clipboard
CameraOptions padding does not work
The padding property of CameraBounds is ignored when calculating coordinate bounds.
This makes it impossible to detect which areas of the map are clear of obstructions like floating buttons and toolbars.
To reproduce:
CameraState c = await mapboxMap.getCameraState();
// get a bounds with padding
var borderPixels = 20.0;
final b1 = await mapboxMap.coordinateBoundsForCamera(CameraOptions(
padding: MbxEdgeInsets(
top: borderPixels,
left: borderPixels,
bottom: borderPixels,
right: borderPixels,
),
center: c.center,
zoom: c.zoom,
pitch: c.pitch,
));
// get a bounds without padding
final b2 = await mapboxMap.coordinateBoundsForCamera(CameraOptions(
center: c.center,
zoom: c.zoom,
pitch: c.pitch,
));
// the coordinates should be different but are the same
bool neSame = b1.northeast.coordinates == b2.northeast.coordinates;
bool swSame = b1.southwest.coordinates == b2.southwest.coordinates;
print('neSame: $neSame'); // prints true
print('swSame: $swSame'); // prints true
Expected behaviour:
The padding should be applied to the bounds returned.