StyleControl class

A control for changing the style of the map.

Extends

Constructors

StyleControl(StyleControlOptions)

Constructs a StyleControl.

Methods

disableStyle(string)

Set style in a disabled state

enableStyle(string)

Enabled style that was previously disabled

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.

setSelectedStyle(string)

Set the style that need to be displayed as currently selected. Style will automatically get selected if StyleControlOptions.autoSelectionMode is true

Inherited Methods

buildContainer<K>(Map, ControlStyle, string, K)

Build the outermost container for the control, applies styling including any listeners for auto styling.

Constructor Details

StyleControl(StyleControlOptions)

Constructs a StyleControl.

new StyleControl(options?: StyleControlOptions)

Parameters

options
StyleControlOptions

The options for the control.

Method Details

disableStyle(string)

Set style in a disabled state

function disableStyle(styleName: string)

Parameters

styleName

string

Style to be disabled

enableStyle(string)

Enabled style that was previously disabled

function enableStyle(styleName: string)

Parameters

styleName

string

Style to be disabled

onAdd(Map, ControlOptions)

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

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

Parameters

map
Map

The map that the control will be added to.

options
ControlOptions

The ControlOptions for this control.

Returns

HTMLElement

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()

setSelectedStyle(string)

Set the style that need to be displayed as currently selected. Style will automatically get selected if StyleControlOptions.autoSelectionMode is true

function setSelectedStyle(styleName: string)

Parameters

styleName

string

Style name that need to be disabled as currently selected

Inherited Method Details

buildContainer<K>(Map, ControlStyle, string, K)

Build the outermost container for the control, applies styling including any listeners for auto styling.

function buildContainer<K>(map: Map, style: ControlStyle, ariaLabel?: string, tagName?: K): HTMLElementTagNameMap[K]

Parameters

map
Map
style
ControlStyle
ariaLabel

string

tagName

K

Returns

HTMLElementTagNameMap[K]

Inherited From ControlBase.buildContainer