leaflet
Version:
JavaScript library for mobile-friendly interactive maps
49 lines (48 loc) • 2.16 kB
TypeScript
import { BlanketOverlay } from '../BlanketOverlay.js';
import type { LeafletEvent, RendererEventMap, RendererOptions } from '../../types.js';
import type { LeafletMap } from '../../map/Map.js';
export type RendererEvents = {
/**
* Fired when the renderer updates its bounds, center and zoom, for example when its
* map has moved.
*/
update: LeafletEvent;
};
/** @import {LeafletEvent, RendererEventMap, RendererOptions} from '../../types.js' */
/** @import {LeafletMap} from '../../map/Map.js' */
/**
* @typedef {Object} RendererEvents
* @property {LeafletEvent} update Fired when the renderer updates its bounds, center and zoom, for example when its
* map has moved.
*/
/**
* Base class for vector renderer implementations (`SVG`, `Canvas`). Handles the DOM container of the renderer,
* its bounds, and its zoom animation.
*
* A `Renderer` works as an implicit layer group for all `Path`s - the renderer itself can be added or removed
* to the map. All paths use a renderer, which can be implicit (the map will decide the type of renderer and
* use it automatically) or explicit (using the [`renderer`](#path-renderer) option of the path).
*
* Do not use this class directly, use `SVG` and `Canvas` instead.
*
* The `continuous` option inherited from `BlanketOverlay` cannot be set to `true` (otherwise, renderers get out of
* place during a pinch-zoom operation).
* @constructorDescription Creates a renderer with the given options.
* @template {RendererOptions} [O=RendererOptions]
* @template {RendererEventMap} [E=RendererEventMap]
* @extends {BlanketOverlay<O, E>}
*/
export declare class Renderer<O extends RendererOptions = RendererOptions, E extends RendererEventMap = RendererEventMap> extends BlanketOverlay<O, E> {
static initHooks: boolean;
/** @param {NoInfer<Partial<O>>} [options] */
constructor(options?: NoInfer<Partial<O>>);
/** @param {LeafletMap} map */
onAdd(map: LeafletMap): void;
/** @param {LeafletMap} map */
onRemove(map: LeafletMap): void;
_onZoomEnd(): void;
_updatePaths(): void;
_onViewReset(): void;
_onSettled(): void;
_update(): void;
}