leaflet
Version:
JavaScript library for mobile-friendly interactive maps
117 lines (116 loc) • 4.99 kB
TypeScript
import { Layer } from '../Layer.js';
import type { Defaults, InteractiveLayerEventMap, PathDefaults, PathOptions, RendererOptions } from '../../types.js';
import type { LeafletMap } from '../../map/Map.js';
import type { Renderer } from './Renderer.js';
/** @import {CanvasOptions, Defaults, InteractiveLayerEventMap, PathDefaults, PathOptions, RendererOptions} from '../../types.js' */
/** @import {LeafletMap} from '../../map/Map.js' */
/** @import {Renderer} from './Renderer.js' */
declare const defaultOptions: {
/** Whether to draw stroke along the path. Set it to `false` to disable borders on polygons or circles. */
stroke: boolean;
/** Stroke color */
color: string;
/** Stroke width in pixels */
weight: number;
/** Stroke opacity */
opacity: number;
/**
* A string that defines [shape to be used at the
* end](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linecap) of the stroke.
* @type {'butt' | 'round' | 'square'}
*/
lineCap: 'butt' | 'round' | 'square';
/**
* A string that defines [shape to be used at the
* corners](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linejoin) of the stroke.
* @type {'miter' | 'round' | 'bevel'}
*/
lineJoin: 'miter' | 'round' | 'bevel';
/**
* A string (or an array of numbers) that defines the stroke [dash
* pattern](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dasharray).
* @type {string | number[] | null}
*/
dashArray: string | number[] | null;
/**
* A string that defines the [distance into the dash pattern to start the
* dash](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dashoffset).
* @type {string | null}
*/
dashOffset: string | null;
/** Whether to fill the path with color. Set it to `false` to disable filling on polygons or circles. */
fill: boolean;
/**
* Fill color. Defaults to the value of the [`color`](#path-color) option.
* @type {string | null}
*/
fillColor: string | null;
/** Fill opacity. */
fillOpacity: number;
/**
* A string that defines [how the inside of a
* shape](https://developer.mozilla.org/docs/Web/SVG/Attribute/fill-rule) is determined.
* @type {'nonzero' | 'evenodd'}
*/
fillRule: 'nonzero' | 'evenodd';
interactive: boolean;
/**
* When `true`, a pointer event on this path will trigger the same event on the map
* (unless [`DomEvent.stopPropagation`](#domevent-stoppropagation) is used).
*/
bubblingPointerEvents: boolean;
/**
* Use this specific instance of `Renderer` for this path. If not set, the path uses the map's
* [renderer](#map-renderer), which is `SVG` by default. If set, it overrides the `pane` option.
* @type {Renderer | undefined}
*/
renderer: Renderer | undefined;
};
export type PathDefaultsValues = typeof defaultOptions;
/** @typedef {typeof defaultOptions} PathDefaultsValues */
/**
* An abstract class that contains options and constants shared between vector overlays (Polygon, Polyline,
* Circle). Do not use it directly. Extends `Layer`.
* @template {PathOptions} [O=PathOptions]
* @template {InteractiveLayerEventMap} [E=InteractiveLayerEventMap]
* @extends {Layer<O & PathDefaults, E>}
*/
export declare class Path<O extends PathOptions = PathOptions, E extends InteractiveLayerEventMap = InteractiveLayerEventMap> extends Layer<O & PathDefaults, E> {
/** @type {Renderer} */
_renderer: Renderer;
/** @type {Defaults<PathOptions>} */
static defaultOptions: Defaults<PathOptions>;
/** @param {LeafletMap} map */
beforeAdd(map: LeafletMap): void;
/** @param {LeafletMap} map */
onAdd(map: LeafletMap): void;
/** @param {LeafletMap} map */
onRemove(map: LeafletMap): void;
/** Redraws the layer. Sometimes useful after you changed the coordinates that the path uses. */
redraw(): this;
/**
* Changes the appearance of a Path based on the options in the `Path options` object. Note that
* [`className`](#path-classname) is an exception: it is applied only when the path element is created,
* so passing it here updates the option but leaves the element's class unchanged.
* @param {Partial<O>} style
*/
setStyle(style: Partial<O>): this;
/** Brings the layer to the top of all path layers. */
bringToFront(): this;
/** Brings the layer to the bottom of all path layers. */
bringToBack(): this;
/**
* Returns the SVG element of the path, or `undefined` when it's drawn on a `Canvas`.
* @returns {SVGElement | undefined}
*/
getElement(): SVGElement | undefined;
/**
* @param {Partial<RendererOptions>} [options]
* @returns {Renderer}
*/
_createRenderer(options?: Partial<RendererOptions>): Renderer;
_togglesPopupOnClick(): boolean;
_reset(): void;
_clickTolerance(): number;
}
export {};