import ViewState from "@arcgis/core/views/2d/ViewState.js";const ViewState = await $arcgis.import("@arcgis/core/views/2d/ViewState.js");- Inheritance:
- ViewState→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 4.8
Object that holds information about the MapView state.
Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
extent
- Type
- Extent
The extent represents the visible portion of a map within the view as an instance of Extent.
- See also
rotation
- Type
- number
The clockwise rotation of due north in relation to the top of the view in degrees.
- See also
- Default value
- 0
scale
- Type
- number
Represents the map scale at the center of the view.
- See also
- Default value
- 0
Methods
| Method | Signature | Class |
|---|---|---|
fromJSON inherited static | fromJSON(json: any): any | |
clone(): ViewState | | |
copy(state: ViewState): this | | |
toJSON inherited | toJSON(): any | |
toMap(out: [
number,
number
], x: number, y: number): [
number,
number
] | | |
toScreen(out: [
number,
number
], x: number, y: number): [
number,
number
] | | |
toScreenNoRotation(out: [
number,
number
], x: number, y: number): [
number,
number
] | |
fromJSON
- Signature
-
fromJSON (json: any): any
Creates a new instance of this class and initializes it with values from a JSON object
generated from an ArcGIS product. The object passed into the input json
parameter often comes from a response to a query operation in the REST API or a
toJSON()
method from another ArcGIS product. See the Using fromJSON()
topic in the Guide for details and examples of when and how to use this function.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| json | A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects. | |
- Returns
- any
Returns a new instance of this class.
clone
- Signature
-
clone (): ViewState
Creates a deep clone of ViewState object.
- Returns
- ViewState
A new instance of a ViewState object equal to the object used to call
.clone().
toJSON
- Signature
-
toJSON (): any
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.
- Returns
- any
The ArcGIS portal JSON representation of an instance of this class.
toScreenNoRotation
- Signature
-
toScreenNoRotation (out: [ number, number ], x: number, y: number): [ number, number ]
Converts the x and y map coordinates to screen coordinates. This method is similar to toScreen(), without applying the view state rotation.