class
Control
Class for the map's controls creating.
new constructor(map, content, options)
Example:
const control = new mapgl.Control(
map,
'<button>Some text</button>',
{ position: 'topLeft' },
);
map
The map instance.
content
Control HTML content.
options
Control options.
setPosition(position)
Sets the position of the control.
position
Required position of the control.
Evented
Event emitter
new constructor
emit(type, data?)
Calls all event listeners with event type
type
type
Event type
data?
Data transferred to events
off(type, listener)
Removes event listener registered with
on
type
Event type
listener
Event handler
on(type, listener)
Registers event listener
type
Event type
listener
Event handler
once(type, listener)
Registers event listener which will be called once
type
Event type
listener
Event handler
Ruler
A class that provides ruler functionality.
new constructor(map, options)
Example:
const ruler = new mapgl.Ruler(map, {});
ruler.setPoints([
[55.31878, 25.23584],
[55.35878, 25.23584],
[55.35878, 25.26584],
]);
emit(type, data?)
Calls all event listeners with event type
type
type
Event type
data?
Data transferred to events
off(type, listener)
Removes event listener registered with
on
type
Event type
listener
Event handler
on(type, listener)
Registers event listener
type
Event type
listener
Event handler
once(type, listener)
Registers event listener which will be called once
type
Event type
listener
Event handler
setPoints(points)
Sets new points. This overrides the previous points.
points
An array of geographical points [longitude, latitude].
RulerControl
A class that provides a ruler control on the map.
new constructor(map, options)
Example:
const control = new mapgl.RulerControl(map, {{ position: 'centerRight' }});
control.getRuler().setPoints([
[55.31878, 25.23584],
[55.35878, 25.23584],
[55.35878, 25.26584],
]);
map
The map instance.
options
Ruler control initialization options.
setPosition(position)
Sets the position of the control.
position
Required position of the control.