@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
117 lines (115 loc) • 3.93 kB
TypeScript
import type Extent from "../../geometry/Extent.js";
import type { JSONSupport } from "../../core/JSONSupport.js";
export interface ViewStateProperties {}
/**
* Object that holds information about the [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) state.
*
* @since 4.8
*/
export default class ViewState extends JSONSupport {
constructor(properties?: ViewStateProperties);
/**
* Represents the view's center point as an array of two numbers `[x, y]`.
*
* @see [MapView.center](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#center)
*/
readonly center: [
number,
number
];
/**
* The extent represents the visible portion of a map within the view as an instance of Extent.
*
* @see [MapView.extent](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#extent)
*/
readonly extent: Extent;
/**
* Represents the size of one pixel in map units. The value of `resolution` is the result of the division of the [extent](https://developers.arcgis.com/javascript/latest/references/core/views/2d/ViewState/#extent) width by the [size](https://developers.arcgis.com/javascript/latest/references/core/views/2d/ViewState/#size).
*
* @default 0
* @since 4.9
*/
readonly resolution: number;
/**
* The clockwise rotation of due north in relation to the top of the view in degrees.
*
* @default 0
* @see [MapView.rotation](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#rotation)
*/
readonly rotation: number;
/**
* Represents the map scale at the center of the view.
*
* @default 0
* @see [MapView.scale](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#scale)
*/
readonly scale: number;
/**
* Represents the width and height of the view in pixels, e.g. `[width, height]`.
*
* @see [MapView.size](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#size)
*/
get size(): [
number,
number
];
/**
* Creates a deep clone of ViewState object.
*
* @returns A new instance of a ViewState object equal to the object used to call `.clone()`.
*/
clone(): ViewState;
/**
* Copies the properties from a given view state.
*
* @param state - The view state to copy the properties from.
* @returns This ViewState instance.
*/
copy(state: ViewState): this;
/**
* Converts the x and y screen coordinates to map coordinates.
*
* @param out - The receiving array of the conversion.
* @param x - The horizontal screen coordinate to convert.
* @param y - The vertical screen coordinate to convert.
* @returns The receiving array of the conversion.
*/
toMap(out: [
number,
number
], x: number, y: number): [
number,
number
];
/**
* Converts the x and y map coordinates to screen coordinates.
*
* @param out - The receiving array of the conversion.
* @param x - The horizontal screen coordinate to convert.
* @param y - The vertical screen coordinate to convert.
* @returns The receiving array of the conversion.
*/
toScreen(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()](https://developers.arcgis.com/javascript/latest/references/core/views/2d/ViewState/#toScreen), without applying the view state rotation.
*
* @param out - The receiving array of the conversion.
* @param x - The horizontal screen coordinate to convert.
* @param y - The vertical screen coordinate to convert.
* @returns The receiving array of the conversion.
*/
toScreenNoRotation(out: [
number,
number
], x: number, y: number): [
number,
number
];
}