Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It is not possible to fit the map to a bounds using the cameraForCoordinates... methods on iOS #666

Open
noforeignland opened this issue Aug 23, 2024 · 0 comments

Comments

@noforeignland
Copy link

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());

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant