UNPKG

@yandex/ymaps3-types

Version:

Types for ymaps3 maps library

57 lines (56 loc) 1.78 kB
import { YMapComplexEntity } from "../YMapEnities"; /** * Types of measurement units that scale control can display. */ export type UnitType = "imperial" | "metric" | "nautical"; /** * Properties for [[YMapScaleControl]] */ type YMapScaleControlProps = { /** Maximum width of scale line in pixels */ maxWidth?: number; /** Units of measurement for the scale line */ unit?: UnitType; }; declare const defaultProps: Readonly<{ maxWidth: 74; unit: "metric"; }>; type DefaultProps = typeof defaultProps; /** * A control that shows the map scale in different units of measurement. * @example Add scale control to the lower left part of the map: * ```js * const scaleControl = new YMapScaleControl({}); * const controls = new YMapControls({position: 'bottom left'}, [scaleControl]); * map.addChild(controls) * ``` * Alternatively, you can show the integrated scale control on the map by `showScaleInCopyrights` props: * ```js * const map = new YMap(document.getElementById('map-root'), { * showScaleInCopyrights: true, * location: {center: [37.622504, 55.753215], zoom: 10} * }); * ``` */ declare class YMapScaleControl extends YMapComplexEntity<YMapScaleControlProps, DefaultProps> { static defaultProps: Readonly<{ maxWidth: 74; unit: "metric"; }>; private _unwatchThemeContext?; private _detachDom?; private _element?; private _labelElement?; private _listener?; constructor(props: YMapScaleControlProps); protected _onAttach(): void; protected _onDetach(): void; private _createDom; private _updateDom; private _updateTheme; private _onMapUpdate; private _updateDistance; private _formatDistance; } export { YMapScaleControl, YMapScaleControlProps };