wrld.js

Control

The base class for all Leaflet controls. Implements IControl interface. You can add controls to the map like this:

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

Creation

Factory Description
L.control( <Control options> options? ) Creates a control with the given options.

Options

Option Type Default Description
position String 'topright' The initial position of the control (one of the map corners). See control positions.

Methods

Method Returns Description
setPosition( <String> position ) this Sets the position of the control. See control positions.
getPosition() String Returns the current position of the control.
addTo( <Map> map ) this Adds the control to the map.
removeFrom( <Map> map ) this Removes the control from the map.
getContainer() HTMLElement Returns the HTML container of the control.

Control Positions

Control positions (map corner to put a control to) are set using strings. Margins between controls and the map border are set with CSS, so that you can easily override them.

Position Description
'topleft' Top left of the map.
'topright' Top right of the map.
'bottomleft' Bottom left of the map.
'bottomright' Bottom right of the map.
v0.1.1335