The options for a zoom operation.

Hierarchy

  • MapNavigatorZoomOptions

Properties

animate?: boolean | MapNavigatorAnimationOptions

When falsy, the zoom operation will be immediate. When truthy, the zoom 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.

factor?: number | {
    x: number;
    y: number;
}

The zoom factor to multiply the map scale with.

Uniform zooming: When you assign a single, strictly positive Number to this option, that number will be used to zoom in a uniform way (the scale for all axes is multiplied with this factor). A factor larger than 1 will zoom in, a factor smaller than 1 will zoom out. Zooming with a factor of 1 will have no effect on the map.

Non-uniform zooming (non-georeferenced, 2D views only): You can use separate factors for the x- and y-axis. To achieve this, you assign an object literal to the factor option. The object literal has to have one or two properties:
  • x The factor to scale the x-axis with.
  • y The factor to scale the y-axis with.
Non-uniform zooming is disabled for georeferenced maps and 3D maps. While it is technically possible to zoom in a non-uniform way on a georeferenced map, it will cause the map to be incorrectly visualized (it distorts the properties of the map's projection). Non-uniform zooming in 3D is not meaningful.

Type declaration

  • x: number
  • y: number
location?: Point

The Point to zoom in to or out from. This point will remain fixed on the map while the scale changes. Can be a view, model or map Point. When omitted, will default to the map's view center.

Note that location will not be moved to the center of the map! Think of it as zooming in with the scroll wheel on a location that is not the center of the map. In this case, location is the location (in pixel coordinates) of the mouse cursor. The point under the cursor remains fixed, while the scale changes.

snapToScaleLevels?: boolean

Indicates whether or not the target 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 flag has an effect on the target zoom level of the zoom operation. When omitted, this defaults to defaults.snapToScaleLevels.

targetScale?: number | {
    x: number;
    y: number;
}

The target scale of the zoom operation.

Uniform zooming: When you assign a single, strictly positive Number to this option, that number will be used to zoom in a uniform way (the scale for all axes is set to this value). After the zoom operation, map.MapScale will equal this value. See map.MapScale for additional details on map scales.

Non-uniform zooming (non-georeferenced, 2D views only): You can use separate scales for the x- and y-axis. To achieve this, you assign an object literal to the targetScale option. The object literal has to have one or two properties:
  • x The target scale for the x-axis.
  • y The target scale for the y-axis.

Type declaration

  • x: number
  • y: number