@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
36 lines (33 loc) • 2.32 kB
TypeScript
import type Accessor from "../../core/Accessor.js";
import type MapView from "../../views/MapView.js";
import type { MeasurementSystem } from "../../core/units.js";
export interface ScaleBarViewModelProperties extends Partial<Pick<ScaleBarViewModel, "view">> {}
export type ScaleBarViewModelState = "disabled" | "ready";
/**
* Provides the logic for the [Scale Bar](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-scale-bar/) component and [ScaleBar](https://developers.arcgis.com/javascript/latest/references/core/widgets/ScaleBar/) widget.
*
* @since 4.3
* @see [Scale Bar](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-scale-bar/) component
* @see [ScaleBar](https://developers.arcgis.com/javascript/latest/references/core/widgets/ScaleBar/) widget - _Deprecated since 4.32. Use the [Scale Bar component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-scale-bar/) instead._
* @see [Programming patterns: Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern)
*/
export default class ScaleBarViewModel extends Accessor {
constructor(properties?: ScaleBarViewModelProperties);
/** The current state of the widget. */
get state(): ScaleBarViewModelState;
/** The view from which the widget will operate. */
accessor view: MapView | null | undefined;
/**
* Computes the size and units of the scale bar widget given a base length in pixels.
*
* @param length - The base width of the scale bar widget in pixels.
* @param measurementSystem - The measurement system to use.
* @returns Property | Type | Description |
* ----------|--------|--------------------------------------------------------|
* length | number | Adjusted length of the scale bar widget in pixels. |
* value | number | The length of the scale bar in map units. |
* unit | "millimeter" \| "centimeter" \| "meter" \| "kilometer" \| "inch" \| "foot" \| "mile" | The map units to use on the scale bar. |
* @since 4.31
*/
getScaleBarProperties(length: number, measurementSystem: MeasurementSystem): any | null | undefined;
}