Control

abstract class Control<T : Control.ControlOptions>(options: T = definedExternally) : Class(source)

Control is a base class for implementing map controls. Handles positioning. All other controls extend from this class.

See https://leafletjs.com/reference.html#control

Inheritors

Constructors

Link copied to clipboard
constructor(options: T = definedExternally)

Types

Link copied to clipboard
interface ControlOptions : JsAny
Link copied to clipboard
interface LayersObject : JsAny

Object literal with layer names as keys and Layer objects as values.

Functions

Link copied to clipboard
fun addInitHook(initHookFn: () -> Unit): JsAny

Adds a constructor hook to the class.

fun addInitHook(methodName: String, vararg args: JsAny): JsAny
Link copied to clipboard
open fun addTo(map: LeafletMap): Control<T>

Adds the control to the given map.

Link copied to clipboard
open fun getContainer(): HTMLElement?

Returns the HTMLElement that contains the control.

Link copied to clipboard

Returns the position of the control.

Link copied to clipboard
fun include(props: JsAny): JsAny

Includes a mixin into the current class.

Link copied to clipboard
fun mergeOptions(props: JsAny): JsAny

Merges options into the defaults of the class.

Link copied to clipboard
fun onAdd(map: LeafletMap): HTMLElement?

Should return the container DOM element for the control and add listeners on relevant map events. Called on addTo

Link copied to clipboard

Optional method. Should contain all clean up code that removes the listeners previously added in onAdd. Called on remove.

Link copied to clipboard
open fun remove(): Control<T>

Removes the control from the map it is currently active on.

Link copied to clipboard
open fun setPosition(position: PositionsUnion): Control<T>

Sets the position of the control.