setMaxBounds method

MapboxMap setMaxBounds(
  1. LngLatBounds? bounds
)

Sets or clears the map's geographical bounds.

Pan and zoom operations are constrained within these bounds. If a pan or zoom is performed that would display regions outside these bounds, the map will instead display a position and zoom level as close as possible to the operation's request while still remaining within the bounds.

@param {LngLatBoundsLike | null | undefined} bounds The maximum bounds to set. If null or undefined is provided, the function removes the map's maximum bounds. @returns {MapboxMap} this @example // Define bounds that conform to the LngLatBoundsLike object. var bounds = [ -74.04728, 40.68392, // west, south -73.91058, 40.87764 // east, north ]; // Set the map's max bounds. map.setMaxBounds(bounds);

Implementation

MapboxMap setMaxBounds(LngLatBounds? bounds) =>
    MapboxMap.fromJsObject(jsObject.setMaxBounds(bounds?.jsObject));