UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

68 lines (64 loc) 4.25 kB
import type Accessor from "../../core/Accessor.js"; import type SceneView from "../../views/SceneView.js"; export interface NavigationToggleViewModelProperties extends Partial<Pick<NavigationToggleViewModel, "navigationMode" | "view">> {} export type NavigationToggleViewModelState = "disabled" | "ready"; export type NavigationToggleViewModelMode = "pan" | "rotate"; /** * Provides the logic for the [NavigationToggle](https://developers.arcgis.com/javascript/latest/references/core/widgets/NavigationToggle/) widget, which provides two simple buttons for * toggling the [navigation mode](https://developers.arcgis.com/javascript/latest/references/core/widgets/NavigationToggle/NavigationToggleViewModel/#navigationMode) of a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). Note that this is not * designed for 2D mouse interaction in a [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/), nor for touch navigation. * * ![navigation-toggle](https://developers.arcgis.com/javascript/latest/assets/references/core/widgets/navigation-toggle.png) * * The default [navigation mode](https://developers.arcgis.com/javascript/latest/references/core/widgets/NavigationToggle/NavigationToggleViewModel/#navigationMode) of the [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/) is always * `pan`. The various mouse interactions of this mode are outlined * [here](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#navigation). * The alternate navigation mode to toggle to is `rotate`. This allows the user to * rotate the view with a mouse drag and pan the view with a right-click and drag * gesture. * * @deprecated since version 4.33. Use the [Navigation Toggle component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-navigation-toggle/) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/). * @since 4.0 * @see [NavigationToggle](https://developers.arcgis.com/javascript/latest/references/core/widgets/NavigationToggle/) widget - _Deprecated since 4.32. Use the [Navigation Toggle component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-navigation-toggle/) instead._ * @see [SceneView navigation](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/) * @see [Programming patterns: Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern) * @example * // creates a new instance of the NavigationToggle * let navigationToggle = new NavigationToggle({ * viewModel: { * view: view * }, * layout: "horizontal" * }); * * // and adds it to the top right of the view * view.ui.add(navigationToggle, "top-right"); */ export default class NavigationToggleViewModel extends Accessor { constructor(properties?: NavigationToggleViewModelProperties); /** * The navigation mode of the [view](https://developers.arcgis.com/javascript/latest/references/core/widgets/NavigationToggle/NavigationToggleViewModel/#view). See the table below for a list of * possible values. * * Possible Value | Description * ---------------|------------- * pan | The mouse drag gesture pans the view. Right-click + drag allows the user to perform a 3D rotate around the center of the view. * rotate | The mouse drag gesture performs a 3D rotate around the center of the view and the right-click + drag gesture pans the view. * * @default "pan" */ accessor navigationMode: NavigationToggleViewModelMode; /** * The state of the widget. * * @default "disabled" */ get state(): NavigationToggleViewModelState; /** The view associated with the widget. */ accessor view: SceneView | null | undefined; /** * Toggles the navigation mode of the [view](https://developers.arcgis.com/javascript/latest/references/core/widgets/NavigationToggle/NavigationToggleViewModel/#view) from `pan` to `rotate` or * vice versa. */ toggle(): void; }