Type Alias: FitOptions
type FitOptions = MapCamera & CameraAnimation & objectOptions interface to select when making a fitBounds call on a map Combines camera configuration with animation options for smooth transitions
Type declaration
maxZoom?
optional maxZoom: number;Max zoom allowed when trying to make a fitBounds call Prevents the map from zooming in too far when fitting bounds
offset?
optional offset: PointLike;Value in which the center of the fit will be moved Allows adjusting the center point of the fitted bounds
onComplete()?
optional onComplete: () => void;Callback function executed when the fit animation completes Called after the camera has finished moving to the new position
Returns
void
Example
map.fitCoordinates(coords, {
onComplete: () => {
console.log("Fit animation completed")
},
})padding?
optional padding: PaddingOptions;Set padding (in pixels) to be added at the edges of the canvas Provides space around the fitted bounds to prevent elements from being cut off
Last updated on