UNPKG

leaflet

Version:

JavaScript library for mobile-friendly interactive maps

86 lines (85 loc) • 3.4 kB
import { Control } from './Control.js'; import type { Defaults, FullscreenControlDefaults, FullscreenControlOptions } from '../types.js'; import type { LeafletMap } from '../map/Map.js'; /** @import {ControlOptions, Defaults, FullscreenControlDefaults, FullscreenControlOptions} 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 button while the map is not fullscreen. */ enterText: string; /** * The title set on the button while the map is not fullscreen. * @translatable */ enterTitle: string; /** The text set on the button while the map is fullscreen. */ exitText: string; /** * The title set on the button while the map is fullscreen. * @translatable */ exitTitle: string; /** * The element to make fullscreen, e.g. a parent that also holds a sidebar. Defaults to the map container. * @type {HTMLElement | undefined} */ container: HTMLElement | undefined; /** * Whether to always fill the window with CSS instead of using the Fullscreen API. The control falls back to * this where the API isn't available, e.g. on iPhone or in an iframe without `allow="fullscreen"`. */ pseudo: boolean; }; export type FullscreenControlDefaultsValues = typeof defaultOptions; /** @typedef {typeof defaultOptions} FullscreenControlDefaultsValues */ /** * A button that toggles fullscreen mode for the map, using the Fullscreen API where available and filling the * window otherwise. The map fires `enterfullscreen` and `exitfullscreen` when the mode changes. Extends `Control`. * * @example * ```js * new FullscreenControl().addTo(map); * ``` * @template {FullscreenControlOptions} [O=FullscreenControlOptions] * @extends {Control<O & FullscreenControlDefaults>} */ export declare class FullscreenControl<O extends FullscreenControlOptions = FullscreenControlOptions> extends Control<O & FullscreenControlDefaults> { _link: HTMLAnchorElement | undefined; /** @type {HTMLElement} */ _target: HTMLElement; /** @type {boolean} */ _fullscreen: boolean; _pseudo: boolean | undefined; /** @type {Defaults<FullscreenControlOptions>} */ static defaultOptions: Defaults<FullscreenControlOptions>; /** * @param {LeafletMap} map * @returns {HTMLElement} */ onAdd(map: LeafletMap): HTMLElement; /** @param {LeafletMap} map */ onRemove(map: LeafletMap): void; /** Returns `true` if the map is in fullscreen mode. */ isFullscreen(): boolean; /** Enters fullscreen mode, or exits it if the map is already fullscreen. */ toggle(): this; /** * Enters fullscreen mode if `on` is `true`, or exits it otherwise. Does nothing if the map is already in that mode. * @param {boolean} on */ setFullscreen(on: boolean): this; /** @param {boolean} on */ _setPseudo(on: boolean): void; /** @param {KeyboardEvent} e */ _onKeyDown(e: KeyboardEvent): void; _onFullscreenChange(): void; /** @param {boolean} on */ _setFullscreen(on: boolean): void; _update(): void; } export {};