leaflet
Version:
JavaScript library for mobile-friendly interactive maps
65 lines (64 loc) • 2.58 kB
TypeScript
import { Control } from './Control.js';
import type { Defaults, ZoomControlDefaults, ZoomControlOptions } from '../types.js';
import type { LeafletMap } from '../map/Map.js';
/** @import {ControlOptions, Defaults, ZoomControlDefaults, ZoomControlOptions} from '../types.js' */
/** @import {LeafletMap} from '../map/Map.js' */
/** @satisfies {Defaults<ControlOptions>} */
declare const defaultOptions: {
/**
* The position of the control (one of the map corners). Possible values
* are `'topleft'`, `'topright'`, `'bottomleft'` or `'bottomright'`
*/
position: "topleft";
/** The text set on the 'zoom in' button. */
zoomInText: string;
/** The title set on the 'zoom in' button. */
zoomInTitle: string;
/** The text set on the 'zoom out' button. */
zoomOutText: string;
/** The title set on the 'zoom out' button. */
zoomOutTitle: string;
};
export type ZoomControlDefaultsValues = typeof defaultOptions;
/** @typedef {typeof defaultOptions} ZoomControlDefaultsValues */
/**
* A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default
* unless you set its [`zoomControl` option](#map-zoomcontrol) to `false`. Extends `Control`.
* @template {ZoomControlOptions} [O=ZoomControlOptions]
* @extends {Control<O & ZoomControlDefaults>}
*/
export declare class ZoomControl<O extends ZoomControlOptions = ZoomControlOptions> extends Control<O & ZoomControlDefaults> {
/** @type {HTMLAnchorElement} */
_zoomInButton: HTMLAnchorElement;
/** @type {HTMLAnchorElement} */
_zoomOutButton: HTMLAnchorElement;
_disabled: boolean | undefined;
/** @type {Defaults<ZoomControlOptions>} */
static defaultOptions: Defaults<ZoomControlOptions>;
/**
* @param {LeafletMap} map
* @returns {HTMLElement}
*/
onAdd(map: LeafletMap): HTMLElement;
/** @param {LeafletMap} map */
onRemove(map: LeafletMap): void;
/** Disables the zoom buttons. */
disable(): this;
/** Enables the zoom buttons again after [`disable`](#zoomcontrol-disable). */
enable(): this;
/**
* @param {MouseEvent} e
* @param {number} dir
*/
_zoom(e: MouseEvent, dir: number): void;
/**
* @param {string} html
* @param {string} title
* @param {string} className
* @param {HTMLElement} container
* @param {(e: MouseEvent) => void} fn
*/
_createButton(html: string, title: string, className: string, container: HTMLElement, fn: (e: MouseEvent) => void): HTMLAnchorElement;
_updateDisabled(): void;
}
export {};