UNPKG

@arcgis/core

Version:

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

108 lines (105 loc) 5.95 kB
import type SceneView from "../views/SceneView.js"; import type Widget from "./Widget.js"; import type NavigationToggleViewModel from "./NavigationToggle/NavigationToggleViewModel.js"; import type { WidgetProperties } from "./Widget.js"; import type { NavigationToggleViewModelProperties } from "./NavigationToggle/NavigationToggleViewModel.js"; export interface NavigationToggleProperties extends WidgetProperties, Partial<Pick<NavigationToggle, "layout" | "view">> { /** * The widget's default label. * * @since 4.7 */ label?: string | null; /** * The view model for this widget. This is a class that contains all the logic * (properties and methods) that controls this widget's behavior. See the * [NavigationToggleViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/NavigationToggle/NavigationToggleViewModel/) class to access * all properties and methods on the widget. */ viewModel?: NavigationToggleViewModelProperties; } export type NavigationToggleLayoutMode = "vertical" | "horizontal"; /** * 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 widget is designed only for 3D mouse interaction in a * [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). It has no effect on touch navigation and it should not be used * with 2D mouse interaction in a [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/). * * ![navigation-toggle](https://developers.arcgis.com/javascript/latest/assets/references/core/widgets/navigation-toggle.png) * * The default navigation mode 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. * * You can use the view's [DefaultUI](https://developers.arcgis.com/javascript/latest/references/core/views/ui/DefaultUI/) to add widgets * to the view's user interface via the [SceneView.ui](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#ui) property on the view. * See the example below. * * @deprecated since version 4.32. 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 [NavigationToggleViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/NavigationToggle/NavigationToggleViewModel/) - _Deprecated since 4.33. 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 [DefaultUI](https://developers.arcgis.com/javascript/latest/references/core/views/ui/DefaultUI/) * @example * // creates a new instance of the NavigationToggle widget * let navigationToggle = new NavigationToggle({ * view: view * }); * * // and adds it to the top right of the view * view.ui.add(navigationToggle, "top-right"); */ export default class NavigationToggle extends Widget { /** * @example * // typical usage * let navigationToggle = new NavigationToggle({ * view: view * }); */ constructor(properties?: NavigationToggleProperties); /** * The widget's default label. * * @since 4.7 */ get label(): string; set label(value: string | null | undefined); /** * Sets the layout of the widget to either `horizontal` or `vertical`. See the * table below for a list of possible values. * * Possible Value | Example * ---------------|-------- * vertical | ![navigation-toggle](https://developers.arcgis.com/javascript/latest/assets/references/core/widgets/navigation-toggle.png) * horizontal | ![navigation-toggle-horizontal](https://developers.arcgis.com/javascript/latest/assets/references/core/widgets/navigation-toggle-horizontal.png) * * @default "vertical" * @example * // creates a new instance of the NavigationToggle widget * let navigationToggle = new NavigationToggle({ * view: view, * layout: "horizontal" // makes the layout horizontal * }); */ accessor layout: NavigationToggleLayoutMode; /** A reference to the [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). Set this to link the widget to a specific view. */ accessor view: SceneView | null | undefined; /** * The view model for this widget. This is a class that contains all the logic * (properties and methods) that controls this widget's behavior. See the * [NavigationToggleViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/NavigationToggle/NavigationToggleViewModel/) class to access * all properties and methods on the widget. */ get viewModel(): NavigationToggleViewModel; set viewModel(value: NavigationToggleViewModelProperties); /** * Toggles the navigation mode of the [view](https://developers.arcgis.com/javascript/latest/references/core/widgets/NavigationToggle/#view) from `pan` to `rotate` or * vice versa. */ toggle(): void; }