UNPKG

@arcgis/core

Version:

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

103 lines (101 loc) 5.43 kB
import type Accessor from "../../core/Accessor.js"; import type Collection from "../../core/Collection.js"; import type Layer from "../../layers/Layer.js"; import type MapView from "../../views/MapView.js"; import type { ReadonlyArrayOrCollection } from "../../core/Collection.js"; import type { Direction, State } from "./types.js"; export interface SwipeViewModelProperties extends Partial<Pick<SwipeViewModel, "direction" | "position" | "step" | "stepMultiplier" | "view">> { /** * A collection of [Layer](https://developers.arcgis.com/javascript/latest/references/core/layers/Layer/)s that will show on the left or top side of the Swipe. * See the image in the [Swipe](https://developers.arcgis.com/javascript/latest/references/core/widgets/Swipe/) class description. * * @see [trailingLayers](https://developers.arcgis.com/javascript/latest/references/core/widgets/Swipe/SwipeViewModel/#trailingLayers) */ leadingLayers?: ReadonlyArrayOrCollection<Layer>; /** * A collection of [Layer](https://developers.arcgis.com/javascript/latest/references/core/layers/Layer/)s that will show on the right or bottom side of the Swipe. * See the image in the [Swipe](https://developers.arcgis.com/javascript/latest/references/core/widgets/Swipe/) class description. * * @see [leadingLayers](https://developers.arcgis.com/javascript/latest/references/core/widgets/Swipe/SwipeViewModel/#leadingLayers) */ trailingLayers?: ReadonlyArrayOrCollection<Layer>; } /** * Provides the logic for the [Swipe widget](https://developers.arcgis.com/javascript/latest/references/core/widgets/Swipe/) and [component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-swipe/). * * @since 4.13 * @see [Swipe widget](https://developers.arcgis.com/javascript/latest/references/core/widgets/Swipe/) - _Deprecated since 4.32. Use the [Swipe component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-swipe/) instead._ * @see [Programming patterns: Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern) */ export default class SwipeViewModel extends Accessor { constructor(properties?: SwipeViewModelProperties); /** * The direction the Swipe moves across the view. * If `"horizontal"`, it will move left and right and * if `"vertical"`, it will move up and down. * * | horizontal | vertical | * |------------|----------| * |[![widgets-swipe-horizontal](https://developers.arcgis.com/javascript/latest/assets/references/core/widgets/widgets-swipe-horizontal.png)](https://developers.arcgis.com/javascript/latest/sample-code/swipe/) |[![widgets-swipe-vertical](https://developers.arcgis.com/javascript/latest/assets/references/core/widgets/widgets-swipe-vertical.png)](https://developers.arcgis.com/javascript/latest/sample-code/swipe/)| * * @default "horizontal" */ accessor direction: Direction; /** * A collection of [Layer](https://developers.arcgis.com/javascript/latest/references/core/layers/Layer/)s that will show on the left or top side of the Swipe. * See the image in the [Swipe](https://developers.arcgis.com/javascript/latest/references/core/widgets/Swipe/) class description. * * @see [trailingLayers](https://developers.arcgis.com/javascript/latest/references/core/widgets/Swipe/SwipeViewModel/#trailingLayers) */ get leadingLayers(): Collection<Layer>; set leadingLayers(value: ReadonlyArrayOrCollection<Layer>); /** * The maximum position of the Swipe, as a percentage. * * @since 4.32 */ get max(): 100; /** * The minimum position of the Swipe, as a percentage. * * @since 4.32 */ get min(): 0; /** * The position of the Swipe. This determines what percentage * of the view will be taken up by the [leadingLayers](https://developers.arcgis.com/javascript/latest/references/core/widgets/Swipe/SwipeViewModel/#leadingLayers). * * @default 25 */ accessor position: number; /** * The current state of the Swipe. * * @default "disabled" */ get state(): State; /** * The step value used to increment or decrement the position of the Swipe when using keyboard navigation. * * @default 0.5 * @since 4.32 */ accessor step: number; /** * The multiplier used to increase the [step](https://developers.arcgis.com/javascript/latest/references/core/widgets/Swipe/SwipeViewModel/#step) value when the `Shift` key is pressed in combination with one of the arrow keys. * * @default 10 * @since 4.32 */ accessor stepMultiplier: number; /** * A collection of [Layer](https://developers.arcgis.com/javascript/latest/references/core/layers/Layer/)s that will show on the right or bottom side of the Swipe. * See the image in the [Swipe](https://developers.arcgis.com/javascript/latest/references/core/widgets/Swipe/) class description. * * @see [leadingLayers](https://developers.arcgis.com/javascript/latest/references/core/widgets/Swipe/SwipeViewModel/#leadingLayers) */ get trailingLayers(): Collection<Layer>; set trailingLayers(value: ReadonlyArrayOrCollection<Layer>); /** A reference to the [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/). Set this to link the Swipe to a specific view. */ accessor view: MapView | null | undefined; }