ym.modules.provider.Control

Overview

The base class for all leaflet controls. It implements the IControl interface.

This allows you to add controls to the map:

control.addTo(map);
// same as
map.addControl(control);  

Initialization

Factory: ym.control(options)

Name Description Data type Default value
options The starting position of the control (one of the card corners). See control positions below. string topright

Methods

setPosition(position) ab v3

Defines the position of the control. See control positions below.

Parameter

Name Description Data type Default value
position      

Return

this

getPosition() ab v3

Returns the current position of the control.

Return

string

addTo(map) ab v3

Adds the control to the map.

Parameter

Name Description Data type Default value
map      

Return

this

removeFrom(map) ab v3

Removes the control from the map.

Parameter

Name Description Data type Default value
map      

Return

this

getContainer() ab v3

Returns the HTML container of the control.

Return

HTML element

Control positions

Position Meaning
topleft Upper left corner of the map.
topright Upper right corner of the map.
bottomleft Lower left corner of the map.
bottomright Lower right corner of the map.