# Type alias View

View: {
center?: number[];
constrainOnlyCenter?: boolean;
constrainResolution?: boolean;
constrainRotation?: boolean | number;
enableRotation?: boolean;
extent?: number[];
maxResolution?: number;
maxZoom?: number;
minResolution?: number;
minZoom?: number;
multiWorld?: boolean;
projection: string;
resolution?: number;
resolutions?: number[];
rotation?: number;
showFullExtent?: boolean;
smoothExtentConstraint?: boolean;
smoothResolutionConstraint?: boolean;
zoom?: number;
zoomFactor?: number;
}

The view definition.

#### Type declaration

- ##### `Optional` center?: number[]

  The initial center for the view. If a user projection is not set, the coordinate system for the center is specified with the `projection` option. Layer sources will not be fetched if this is not set, but the center can be set later with #setCenter.

- ##### `Optional` constrainOnlyCenter?: boolean

  If true, the extent constraint will only apply to the view center and not the whole extent.

- ##### `Optional` constrainResolution?: boolean

  If true, the view will always animate to the closest zoom level after an interaction; false means intermediary zoom levels are allowed.

- ##### `Optional` constrainRotation?: boolean | number

  Rotation constraint. `false` means no constraint. `true` means no constraint, but snap to zero near zero. A number constrains the rotation to that number of values. For example, `4` will constrain the rotation to 0, 90, 180, and 270 degrees.

- ##### `Optional` enableRotation?: boolean

  Enable rotation. If `false`, a rotation constraint that always sets the rotation to zero is used. The `constrainRotation` option has no effect if `enableRotation` is `false`.

- ##### `Optional` extent?: number[]

  The extent that constrains the view, in other words, nothing outside of this extent can be visible on the map.

- ##### `Optional` maxResolution?: number

  The maximum resolution used to determine the resolution constraint. It is used together with `minResolution` (or `maxZoom`) and `zoomFactor`. If unspecified it is calculated in such a way that the projection's validity extent fits in a 256x256 px tile. If the projection is Spherical Mercator (the default) then `maxResolution` defaults to `40075016.68557849 / 256 = 156543.03392804097`.

- ##### `Optional` maxZoom?: number

  The maximum zoom level used to determine the resolution constraint. It is used together with `minZoom` (or `maxResolution`) and `zoomFactor`. Note that if `minResolution` is also provided, it is given precedence over `maxZoom`.

- ##### `Optional` minResolution?: number

  The minimum resolution used to determine the resolution constraint. It is used together with `maxResolution` (or `minZoom`) and `zoomFactor`. If unspecified it is calculated assuming 29 zoom levels (with a factor of 2). If the projection is Spherical Mercator (the default) then `minResolution` defaults to `40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253`.

- ##### `Optional` minZoom?: number

  The minimum zoom level used to determine the resolution constraint. It is used together with `maxZoom` (or `minResolution`) and `zoomFactor`. Note that if `maxResolution` is also provided, it is given precedence over `minZoom`.

- ##### `Optional` multiWorld?: boolean

  If `false` the view is constrained so only one world is visible, and you cannot pan off the edge. If `true` the map may show multiple worlds at low zoom levels. Only used if the `projection` is global. Note that if `extent` is also provided it is given precedence.

- ##### projection: string

  The main projection.

- ##### `Optional` resolution?: number

  The initial resolution for the view. The units are `projection` units per pixel (e.g. meters per pixel). An alternative to setting this is to set `zoom`. Layer sources will not be fetched if neither this nor `zoom` are defined, but they can be set later with #setZoom or #setResolution.

- ##### `Optional` resolutions?: number[]

  Resolutions to determine the resolution constraint. If set the `maxResolution`, `minResolution`, `minZoom`, `maxZoom`, and `zoomFactor` options are ignored.

- ##### `Optional` rotation?: number

  The initial rotation for the view in radians (positive rotation clockwise, 0 means North).

- ##### `Optional` showFullExtent?: boolean

  Allow the view to be zoomed out to show the full configured extent. By default, when a view is configured with an extent, users will not be able to zoom out so the viewport exceeds the extent in either dimension. This means the full extent may not be visible if the viewport is taller or wider than the aspect ratio of the configured extent. If showFullExtent is true, the user will be able to zoom out so that the viewport exceeds the height or width of the configured extent, but not both, allowing the full extent to be shown.

- ##### `Optional` smoothExtentConstraint?: boolean

  If true, the extent constraint will be applied smoothly, i.e. allow the view to go slightly outside of the given `extent`.

- ##### `Optional` smoothResolutionConstraint?: boolean

  If true, the resolution min/max values will be applied smoothly, i. e. allow the view to exceed slightly the given resolution or zoom bounds.

- ##### `Optional` zoom?: number

  Only used if `resolution` is not defined. Zoom level used to calculate the initial resolution for the view.

- ##### `Optional` zoomFactor?: number

  The zoom factor used to compute the corresponding resolution.

- Defined in srcapi/store/config.ts:625

Generated using TypeDoc