UNPKG

leaflet

Version:

JavaScript library for mobile-friendly interactive maps

73 lines (72 loc) • 2.82 kB
import { Control } from './Control.js'; import type { AttributionControlDefaults, AttributionControlOptions, Defaults } from '../types.js'; import type { LayerBase } from '../layer/LayerBase.js'; import type { 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: "bottomright"; /** * The HTML text shown before the attributions. Pass `false` to disable. * @type {string | false} */ prefix: string | false; }; export type AttributionControlDefaultsValues = typeof defaultOptions; /** @typedef {typeof defaultOptions} AttributionControlDefaultsValues */ /** * The attribution control allows you to display attribution data in a small text box on a map. It is put * on the map by default unless you set its [`attributionControl` option](#map-attributioncontrol) to * `false`, and it fetches attribution texts from layers with the [`getAttribution` * method](#layer-getattribution) automatically. Extends `Control`. * @template {AttributionControlOptions} [O=AttributionControlOptions] * @extends {Control<O & AttributionControlDefaults>} */ export declare class AttributionControl<O extends AttributionControlOptions = AttributionControlOptions> extends Control<O & AttributionControlDefaults> { /** @type {{[text: string]: number}} */ _attributions: { [text: string]: number; }; /** @type {Map<LayerBase, string>} */ _layerAttributions: Map<LayerBase, string>; static initHooks: boolean; /** @type {Defaults<AttributionControlOptions>} */ static defaultOptions: Defaults<AttributionControlOptions>; /** * Creates an attribution control. * @param {NoInfer<Partial<O>>} [options] */ constructor(options?: NoInfer<Partial<O>>); /** @param {LeafletMap} map */ onAdd(map: LeafletMap): HTMLElement; /** @param {LeafletMap} map */ onRemove(map: LeafletMap): void; /** @param {{layer: LayerBase}} e */ _addLayer({ layer }: { layer: LayerBase; }): void; /** @param {{layer: LayerBase}} e */ _removeLayer({ layer }: { layer: LayerBase; }): void; /** * Sets the HTML text shown before the attributions. Pass `false` to disable. * @param {string | false} prefix */ setPrefix(prefix: string | false): this; /** * Adds an attribution text (e.g. `'&copy; OpenStreetMap contributors'`). * @param {string} text */ addAttribution(text: string): this; /** * Removes an attribution text. * @param {string} text */ removeAttribution(text: string): this; _update(): void; } export {};