fitBounds method
Pans and zooms the map to contain its visible area within the specified geographical bounds. This function will also reset the map's bearing to 0 if bearing is nonzero.
@memberof MapboxMap#
@param bounds Center these bounds in the viewport and use the highest
zoom level up to and including MapboxMap#getMaxZoom() that fits them in the viewport.
@param {Object} options Options supports all properties from {@link AnimationOptions} and {@link CameraOptions} in addition to the fields below.
@param {number | PaddingOptions} options.padding The amount of padding in pixels to add to the given bounds.
@param {boolean} options.linear=false If true, the map transitions using
{@link MapboxMap#easeTo}. If false, the map transitions using {@link MapboxMap#flyTo}. See
those functions and {@link AnimationOptions} for information about options available.
@param {Function} options.easing An easing function for the animated transition. See {@link AnimationOptions}.
@param {PointLike} options.offset=[0, 0] The center of the given bounds relative to the map's center, measured in pixels.
@param {number} options.maxZoom The maximum zoom level to allow when the map view transitions to the specified bounds.
@param {Object} eventData Additional properties to be added to event objects of events triggered by this method.
@fires movestart
@fires moveend
@returns {MapboxMap} this
@example
var bbox = [-79, 43, -73, 45];
map.fitBounds(bbox, {
padding: {top: 10, bottom:25, left: 15, right: 5}
});
@see Fit a map to a bounding box
Implementation
MapboxMap fitBounds(LngLatBounds bounds,
[Map<String, dynamic>? options, dynamic eventData]) =>
MapboxMap.fromJsObject(
jsObject.fitBounds(bounds.jsObject, jsify(options ?? {}), eventData));