Skip to main content

controls

Controls is a user interface components by which a user can interact with the map.

DG.Control.Zoom

A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its zoomControl option to false. Extends Control.

Creation

FactoryDescription
DG.control.zoom( <DG.Control.Zoom options> options ) Creates a zoom control

Options

OptionTypeDefaultDescription
zoomInTextString '+'The text set on the 'zoom in' button.
zoomInTitleString 'Zoom in'The title set on the 'zoom in' button.
zoomOutTextString '-'The text set on the 'zoom out' button.
zoomOutTitleString 'Zoom out'The title set on the 'zoom out' button.

Options inherited from Control

Methods

Methods inherited from Control

DG.Control.Attribution

The attribution control allows you to display attribution data in a small text box on a map. It is put on the map by default unless you set its attributionControl option to false, and it fetches attribution texts from layers with the getAttribution method automatically. Extends DG.Control.

Creation

FactoryDescription
DG.control.attribution( <DG.Control.Attribution options> options ) Creates an attribution control.

Options

OptionTypeDefaultDescription
prefixString 'Leaflet'The HTML text shown before the attributions. Pass false to disable.

Options inherited from Control

Methods

MethodReturnsDescription
setPrefix( <String> prefix ) thisSets the text before the attributions.
addAttribution( <String> text ) thisAdds an attribution text (e.g. 'Vector data &copy; Mapbox').
removeAttribution( <String> text ) thisRemoves an attribution text.

Methods inherited from Control

DG.Control.Scale

A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems. Extends DG.Control.

DG.control.scale().addTo(map);

Creation

FactoryDescription
DG.control.scale( <DG.Control.Scale options> options? ) Creates an scale control with the given options.

Options

OptionTypeDefaultDescription
maxWidthNumber 100Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500).
metricBoolean TrueWhether to show the metric scale line (m/km).
imperialBoolean TrueWhether to show the imperial scale line (mi/ft).
updateWhenIdleBoolean falseIf true, the control is updated on moveend, otherwise it's always up-to-date (updated on move).

Options inherited from Control

Methods

Methods inherited from Control

DG.Control.Ruler

When clicked opens a ruler - the tool for measurement of distances on a map. Extends DG.Control.

DG.control.ruler().addTo(map);

Creation

FactoryDescription
DG.control.ruler( <DG.Control.Ruler options> options? ) Creates a ruler control with the given options.

Options

Options inherited from Control

Methods

Methods inherited from Control

DG.Control.Traffic

The traffic control allows you to display traffic overlay data on a map. Extends DG.Control.

DG.control.traffic().addTo(map);

Creation

FactoryDescription
DG.control.traffic( <DG.Control.Traffic options> options? ) Creates a traffic control with the given options.

Options

Options inherited from Control

Methods

Methods inherited from Control

DG.Control.Fullscreen

The fullscreen control enables display of the map over fullscreen window which bounds are physical bounds of a given user monitor. The button works like a trigger. It is put on the map by default unless you set its fullscreenControl option to false. Extends DG.Control.

DG.control.fullscreen().addTo(map);

Creation

FactoryDescription
DG.control.fullscreen( <DG.Control.Fullscreen options> options? ) Creates a fullscreen control with the given options.

Options

Options inherited from Control

Methods

Methods inherited from Control

DG.Control.LocationControl

The geo-location control allow users to detect their geographic positions and automatically pan the map layer to found coordinates. Control is disabled if geo-location API is not available.

DG.control.location().addTo(map);

Creation

FactoryDescription
DG.control.location( <DG.Control.LocationControl options> options? ) Creates a geo-location control with the given options.

Options

OptionTypeDefaultDescription
drawCircleBoolean trueWill the circle showing the accuracy of the detection be displayed or not.
followBoolean falseUpdate user location dynamically or not, works if watch and setView options are exposed to true in locateOptions.
stopFollowingOnDragBoolean falseEnables or disables the user's location update as he drag the map.
metricBoolean trueUse metric or English units of measurement.
locateOptionsObject See geo-location options.

Options inherited from Control

Methods

Methods inherited from Control