Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Control

Hierarchy

Implements

Index

Constructors

constructor

  • Creates a control with the given options.

    Parameters

    Returns Control

Methods

addTo

  • addTo(map: Map): Control
  • Adds the control to the map.

    Parameters

    Returns Control

getContainer

  • getContainer(): HTMLElement
  • Returns the HTML container of the control.

    Returns HTMLElement

getPosition

  • getPosition(): string
  • Returns the current position of the control.

    Returns string

onAdd

  • onAdd(map: Map): HTMLElement
  • Should contain code that creates all the neccessary DOM elements for the control, adds listeners on relevant map events, and returns the element containing the control. Called on map.addControl(control) or control.addTo(map).

    Parameters

    Returns HTMLElement

onRemove

  • onRemove(map: Map): void
  • Optional, should contain all clean up code (e.g. removes control's event listeners). Called on map.removeControl(control) or control.removeFrom(map). The control's DOM container is removed automatically.

    Parameters

    Returns void

removeFrom

  • removeFrom(map: Map): Control
  • Removes the control from the map.

    Parameters

    Returns Control

setPosition

  • setPosition(position: string): Control
  • Sets the position of the control. See control positions.

    Parameters

    • position: string

    Returns Control

Static addInitHook

  • addInitHook(methodName: string, ...args: any[]): void
  • You can also use the following shortcut when you just need to make one additional method call.

    Parameters

    • methodName: string
    • Rest ...args: any[]

    Returns void

Static extend

  • You use L.Class.extend to define new classes, but you can use the same method on any class to inherit from it.

    Parameters

    Returns any