The options for a fit operation.

Hierarchy

  • MapNavigatorFitOptions

Properties

allowWarpXYAxis?: boolean

This can only be set to true if the Map is used to visualize data that is not spatial in nature. For example, when the Map's reference axes represent units of measure like speed, distance, or volume. See createCartesianReference for more information on how to create such a reference.

Indicates whether the scale ratio will be adapted to be able to obtain a perfect fit. The default value is false. Perfect fit means the existing aspect ratio between the horizontal and vertical scale of the map will be adjusted independently.

Consider a map which is shown in a wide rectangular screenport (e.g. 16:9) but on which you perform a perfect fit with a square bounds. Doing so would cause a warping effect, compressing the y-axis to ensure it is in the view. However, when the data on the map is specified in a coordinates system in which x and y do not represent the same kind of quantity, setting allowWarpXYAxis to true is a convenient way to show all data on the map in that bounds, without any extra padding and the associated loss of screen real-estate. In such a case, a stretch or compression along an axis may be a desired effect.

animate?: boolean | MapNavigatorAnimationOptions

When falsy, the fit operation will be immediate. When truthy, the fit operation will be animated.

The default value is false.

Regardless of the value of 'animate', you have to wait for the returned Promise to resolve to ensure that the map has navigated to the target position. To alter the animation, you can assign an MapNavigatorAnimationOptions to this option.

bounds: Bounds

The Bounds to fit on. Can be in a model, map or view reference.

fitMargin?: string

The fit margin is the margin between the bounds to fit on and the edge of the visible map. Can be specified in either percentage of the map's screen dimensions, or as a fixed amount of pixels.

A fit margin of "5%" will add a margin of 5% of the map's screen dimensions on each side of the bounds, the center remains unchanged.

A fit margin of "10px" will add a margin of 10 pixels on each side of the bounds, the center remains unchanged. Setting this to "0%", "0px" or just "0" will remove the margin.

When omitted, defaults.fit.fitMargin will be used.

snapToScaleLevels?: boolean

Indicates whether or not the target camera position's zoom level should be snapped to layer scale levels (to allow for pixel-perfect display of raster layers).

Only has effect on 2D maps.

Note that this can affect the accuracy of the fit operation.

When omitted, this defaults to defaults.snapToScaleLevels.