fitCameraToGeometry method
- Object? geometry,
- CameraFitUpdate update
Moves the camera to fit a GeoJSON geometry in the map's view, at once or with an animation.
geometry is a GeoJSON geometry object with at least one coordinate, not
a feature. The camera is the one that MapHandle.cameraForGeometry()
computes after the commands sent before this one apply. The function
finishes when the map applies the change, before an animation ends.
See mln_map_fit_camera_to_geometry in the
C API reference.
Errors:
Status.invalidArgumentwhen the padding inupdateleaves no room for the area. The camera doesn't move.
Implementation
Future<CommandCompletion> fitCameraToGeometry(
Object? geometry,
CameraFitUpdate update,
) => _command((arena, completion) {
final registrations = _NativeRegistrations(_callbackRoots);
return registrations.run(
() => raw.mln_map_fit_camera_to_geometry(
_handle.raw,
_nativeJsonView(geometry, arena),
_writeCameraFitUpdate(update, arena, registrations),
completion,
nativeDiagnostic,
),
);
});