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(
|
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(
|
this |
Sets the position of the control. See control positions. |
getPosition() |
String |
Returns the current position of the control. |
addTo(
|
this |
Adds the control to the map. |
removeFrom(
|
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
- L.Wrld.themes
- Event objects
- WrldPoiApi
- L.Map
- L.Marker
- L.Popup
- L.TileLayer
- L.TileLayer.WMS
- L.TileLayer.Canvas
- L.ImageOverlay
- L.Path
- L.Polyline
- L.MultiPolyline
- L.Polygon
- L.MultiPolygon
- L.Rectangle
- L.Circle
- L.CircleMarker
- L.LayerGroup
- L.FeatureGroup
- L.GeoJson
- L.LatLng
- L.LatLngBounds
- L.Point
- L.Bounds
- L.Icon
- L.DivIcon
- L.Control
- L.Control.zoom
- L.Control.Attribution
- L.Control.Layers
- L.Control.Scale
- Events methods
- Event objects
- L.Class
- L.Browser
- L.Util
- L.Transformation
- L.LineUtil
- L.PolyUtil
- L.DomEvent
- L.DomUtil
- L.PosAnimation
- L.Draggable
- L.IHandler
- L.ILayer
- L.IControl
- L.IProjection
- L.ICRS
- Global Switches
- L.noConflict
- L.version
Themes
Events
Services (Optional)
Leaflet
Themes
L.Wrld.themes
Events
Event objects
Services (Optional)
WrldPoiApi
Leaflet
L.Map
L.Marker
L.Popup
L.TileLayer
L.TileLayer.WMS
L.TileLayer.Canvas
L.ImageOverlay
L.Path
L.Polyline
L.MultiPolyline
L.Polygon
L.MultiPolygon
L.Rectangle
L.Circle
L.CircleMarker
L.LayerGroup
L.FeatureGroup
L.GeoJson
L.LatLng
L.LatLngBounds
L.Point
L.Bounds
L.Icon
L.DivIcon
L.Control
L.Control.zoom
L.Control.Attribution
L.Control.Layers
L.Control.Scale
Events methods
Event objects
L.Class
L.Browser
L.Util
L.Transformation
L.LineUtil
L.PolyUtil
L.DomEvent
L.DomUtil
L.PosAnimation
L.Draggable
L.IHandler
L.ILayer
L.IControl
L.IProjection
L.ICRS
Global Switches
L.noConflict
L.version