UNPKG

leaflet

Version:

JavaScript library for mobile-friendly interactive maps

116 lines (115 loc) • 4.66 kB
import { Layer } from './Layer.js'; import { Bounds } from '../geometry/Bounds.js'; import type { BlanketOverlayDefaults, BlanketOverlayOptions, Defaults, LayerEventMap, LeafletEvent, MapListeners, ZoomAnimEvent } from '../types.js'; import type { LatLng } from '../geo/LatLng.js'; import type { LeafletMap } from '../map/Map.js'; import type { Point } from '../geometry/Point.js'; /** @import {BlanketOverlayDefaults, BlanketOverlayOptions, Defaults, LayerEventMap, LeafletEvent, MapListeners, ZoomAnimEvent} from '../types.js' */ /** @import {LatLng} from '../geo/LatLng.js' */ /** @import {LeafletMap} from '../map/Map.js' */ /** @import {Point} from '../geometry/Point.js' */ declare const defaultOptions: { /** * How much to extend the clip area around the map view (relative to its size), e.g. 0.1 would be 10% of map * view in each direction. */ padding: number; /** * When `false`, the blanket will update its position only when the map state settles (*after* a pan/zoom * animation). When `true`, it will update when the map state changes (*during* pan/zoom animations) */ continuous: boolean; }; export type BlanketOverlayDefaultsValues = typeof defaultOptions; /** @typedef {typeof defaultOptions} BlanketOverlayDefaultsValues */ /** * Represents an HTML element that covers ("blankets") the entire surface of the map. * * Do not use this class directly. It's meant for `Renderer`, and for plugins that rely on one single HTML element. * @categoryDescription Subclass interface * Subclasses must define the following methods: * @template {BlanketOverlayOptions} [O=BlanketOverlayOptions] * @template {LayerEventMap} [E=LayerEventMap] * @extends {Layer<O & BlanketOverlayDefaults, E>} */ export declare class BlanketOverlay<O extends BlanketOverlayOptions = BlanketOverlayOptions, E extends LayerEventMap = LayerEventMap> extends Layer<O & BlanketOverlayDefaults, E> { /** @type {Bounds} */ _bounds: Bounds; /** @type {LatLng} */ _center: LatLng; /** @type {number} */ _zoom: number; /** @type {HTMLElement | SVGElement} */ _container: HTMLElement | SVGElement; static initHooks: boolean; /** @type {Defaults<BlanketOverlayOptions>} */ static defaultOptions: Defaults<BlanketOverlayOptions>; /** * Creates a blanket overlay with the given options. * @param {NoInfer<Partial<O>>} [options] */ constructor(options?: NoInfer<Partial<O>>); /** @param {LeafletMap} map */ onAdd(map: LeafletMap): void; /** @param {LeafletMap} map */ onRemove(map: LeafletMap): void; getEvents(): MapListeners; /** @param {ZoomAnimEvent} ev */ _onAnimZoom(ev: ZoomAnimEvent): void; _onZoom(): void; /** * @param {LatLng} center * @param {number} zoom */ _updateTransform(center: LatLng, zoom: number): void; /** @param {LeafletEvent} [ev] */ _onMoveEnd(ev?: LeafletEvent): void; _reset(): void; /** * Must initialize the HTML element to use as blanket, and store it as `this._container`. The base * implementation creates a blank `<div>`. * @category Subclass interface * @uninheritable */ _initContainer(): void; /** * Must destroy the HTML element in `this._container` and free any other resources. The base implementation * destroys the element and removes any event handlers attached to it. * @category Subclass interface * @uninheritable */ _destroyContainer(): void; /** * The base implementation resizes the container (based on the map's size and taking into account the * padding), returning the new size in CSS pixels. * * Subclass implementations shall reset container parameters and data structures as needed. * @category Subclass interface * @uninheritable */ _resizeContainer(): Point; /** * (Optional) Runs on the map's `zoomend` event. * @category Subclass interface * @uninheritable */ _onZoomEnd(): void; /** * (Optional) Runs on the map's `viewreset` event. * @category Subclass interface * @uninheritable */ _onViewReset(): void; /** * Runs whenever the map state settles after changing (at the end of pan/zoom animations, etc). This should * trigger the bulk of any rendering logic. * * If the `continuous` option is set to `true`, then this also runs on any map state change (including * *during* pan/zoom animations). * @category Subclass interface * @param {LeafletEvent} [ev] * @uninheritable */ _onSettled(ev?: LeafletEvent): void; } export {};