Control interface

An interface for defining a control of the map.

Methods

onAdd(Map, ControlOptions)

Initialization method for the control which is called when added to the map.

onRemove()

Method that is called when the control is removed from the map. Should perform any necessary cleanup for the control.

Method Details

onAdd(Map, ControlOptions)

Initialization method for the control which is called when added to the map.

function onAdd(map: Map, options?: ControlOptions): HTMLElement | null

Parameters

map
Map

The map that the control will be added to.

options
ControlOptions

The ControlOptions for this control.

Returns

HTMLElement | null

An HTMLElement to be placed on the map for the control.

onRemove()

Method that is called when the control is removed from the map. Should perform any necessary cleanup for the control.

function onRemove()