mapbox / mapbox/mapbox-maps-flutter
It is not possible to fit the map to a bounds using the cameraForCoordinates... methods on iOS
Open
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 380
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
On Android it is possible to move the camera to fit a bounds. On iOS the same code fails to work.
Swap the varialbe c[n] at the end of this code to test the different methods. All are fine on Android but fail on an iPhone:
var sw = Point(coordinates: Position(bounds.w, bounds.s));
var ne = Point(coordinates: Position(bounds.e, bounds.n));
CameraOptions c = await mapboxMap.cameraForCoordinateBounds(
CoordinateBounds(southwest: sw, northeast: ne, infiniteBounds: false),
MbxEdgeInsets(top: paddingTop, left: paddingLeft, bottom: paddingBottom, right: paddingRight),
0,
MapConst.defaultFindZoomLevel,
20,
ScreenCoordinate(x: 0, y: 0),
);
CameraOptions c2 = await mapboxMap.cameraForCoordinatesPadding(
[sw, ne],
CameraOptions(pitch: 40),
MbxEdgeInsets(top: paddingTop, left: paddingLeft, bottom: paddingBottom, right: paddingRight),
MapConst.defaultFindZoomLevel,
ScreenCoordinate(x: 0, y: 0),
);
CameraOptions c3 = await mapboxMap.cameraForCoordinates([sw, ne], MbxEdgeInsets(top: paddingTop, left: paddingLeft, bottom: paddingBottom, right: paddingRight), 0, 0);
CameraOptions c4 = await mapboxMap.cameraForCoordinatesCameraOptions([sw, ne], CameraOptions(), ScreenBox(min: ScreenCoordinate(x: 0, y: 0), max: ScreenCoordinate(x: 100, y: 100)));
var point = {
"type": "Point",
"coordinates": [1, 2]
};
CameraOptions c5 = await mapboxMap.cameraForGeometry(point, MbxEdgeInsets(top: paddingTop, left: paddingLeft, bottom: paddingBottom, right: paddingRight), 0, 0);
mapboxMap.easeTo(c, MapAnimationOptions());
`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the supplied cameraForCoordinateBounds, cameraForCoordinates, cameraForGeometry, and easeTo calls on an iPhone, then compare their behavior with Android. Done means the camera-for-coordinates methods fit the supplied bounds and the resulting CameraOptions can be applied on iOS as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100