Class Path

L.Class powers the OOP facilities of Leaflet and is used to create almost all of the Leaflet classes documented.

Hierarchy

Index

Properties

Methods

Properties

public static CANVAS: boolean

True if Canvas is used for vector rendering (Android 2). You can also force this by setting global variable L_PREFER_CANVAS to true before the Leaflet include on your page — sometimes it can increase performance dramatically when rendering thousands of circle markers, but currently suffers from a bug that causes removing such layers to be extremely slow.

public static CLIP_PADDING: number

How much to extend the clip area around the map view (relative to its size, e.g. 0.5 is half the screen in each direction). Smaller values mean that you will see clipped ends of paths while you're dragging the map, and bigger values decrease drawing performance.

public static SVG: boolean

True if SVG is used for vector rendering (true for most modern browsers).

public static VML: boolean

True if VML is used for vector rendering (IE 6-8).

Methods

public addEventListener(type: string, fn: (e: L.LeafletEvent) => void, context?: any): Path

Parameters

  • type: string
  • fn: (e: L.LeafletEvent) => void
  • context?: any optional

Returns

Path

public addEventListener(eventMap: any, context?: any): Path

Parameters

  • eventMap: any
  • context?: any optional

Returns

Path

public addOneTimeEventListener(type: string, fn: (e: L.LeafletEvent) => void, context?: any): Path

Parameters

  • type: string
  • fn: (e: L.LeafletEvent) => void
  • context?: any optional

Returns

Path

public addTo(map: Map): Path

Adds the layer to the map.

Parameters

Returns

Path

public bindPopup(html: string, options?: PopupOptions): Path

Binds a popup with a particular HTML content to a click on this path.

Parameters

Returns

Path

public bindPopup(el: HTMLElement, options?: PopupOptions): Path

Binds a popup with a particular HTML content to a click on this path.

Parameters

Returns

Path

public bindPopup(popup: Popup, options?: PopupOptions): Path

Binds a popup with a particular HTML content to a click on this path.

Parameters

Returns

Path

public bringToBack(): Path

Brings the layer to the bottom of all path layers.

Returns

Path

public bringToFront(): Path

Brings the layer to the top of all path layers.

Returns

Path

public clearAllEventListeners(): Path

Returns

Path

public closePopup(): Path

Closes the path's bound popup if it is opened.

Returns

Path

public fire(type: string, data?: any): Path

Parameters

  • type: string
  • data?: any optional

Returns

Path

public fireEvent(type: string, data?: any): Path

Parameters

  • type: string
  • data?: any optional

Returns

Path

public getBounds(): LatLngBounds

Returns the LatLngBounds of the path.

Returns

LatLngBounds

public hasEventListeners(type: string): boolean

Parameters

  • type: string

Returns

boolean

public off(type: string, fn?: (e: L.LeafletEvent) => void, context?: any): Path

Parameters

  • type: string
  • fn?: (e: L.LeafletEvent) => void optional
  • context?: any optional

Returns

Path

public off(eventMap?: any, context?: any): Path

Parameters

  • eventMap?: any optional
  • context?: any optional

Returns

Path

public on(type: string, fn: (e: L.LeafletEvent) => void, context?: any): Path

Parameters

  • type: string
  • fn: (e: L.LeafletEvent) => void
  • context?: any optional

Returns

Path

public on(eventMap: any, context?: any): Path

Parameters

  • eventMap: any
  • context?: any optional

Returns

Path

public onAdd(map: Map)

Should contain code that creates DOM elements for the overlay, adds them to map panes where they should belong and puts listeners on relevant map events. Called on map.addLayer(layer).

Parameters

public onRemove(map: Map)

Should contain all clean up code that removes the overlay's elements from the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).

Parameters

public once(type: string, fn: (e: L.LeafletEvent) => void, context?: any): Path

Parameters

  • type: string
  • fn: (e: L.LeafletEvent) => void
  • context?: any optional

Returns

Path

public openPopup(latlng?: LatLng): Path

Opens the popup previously bound by the bindPopup method in the given point, or in one of the path's points if not specified.

Parameters

Returns

Path

public redraw(): Path

Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.

Returns

Path

public removeEventListener(type: string, fn?: (e: L.LeafletEvent) => void, context?: any): Path

Parameters

  • type: string
  • fn?: (e: L.LeafletEvent) => void optional
  • context?: any optional

Returns

Path

public removeEventListener(eventMap?: any, context?: any): Path

Parameters

  • eventMap?: any optional
  • context?: any optional

Returns

Path

public setStyle(object: PathOptions): Path

Changes the appearance of a Path based on the options in the Path options object.

Parameters

Returns

Path

public unbindPopup(): Path

Unbinds the popup previously bound to the path with bindPopup.

Returns

Path