Drag Mode
You can handle Drag Mode for all layers on a map like this:
map.gm.enableGlobalDragMode();
map.gm.disableGlobalDragMode();
map.gm.toggleGlobalDragMode();
map.gm.globalDragModeEnabled();
// Or like this:
map.gm.enableMode('edit', 'drag');
map.gm.disableMode('edit', 'drag');
map.gm.toggleMode('edit', 'drag');
map.gm.isModeEnabled('edit', 'drag');
The following methods are available on map.gm
:
Method | Returns | Description |
---|---|---|
enableGlobalDragMode() | - | Enables global Drag Mode. |
disableGlobalDragMode() | - | Disables global Drag Mode. |
toggleGlobalDragMode() | - | Toggles global Drag Mode. |
globalDragModeEnabled() | Boolean | Returns true if global Drag Mode is enabled. false when disabled. |
The following events are available on a map instance:
Event | Params | Description | Output |
---|---|---|---|
gm:dragstart | event | Fired when a layer starts being dragged. | map , feature , shape |
gm:drag | event | Fired when a layer is dragged. | map , feature , shape |
gm:dragend | event | Fired when a layer stops being dragged. | map , feature , shape |
The following events are available on a map instance:
Event | Params | Description | Output |
---|---|---|---|
gm:globaldragmodetoggled | event | Fired when Drag Mode is toggled. | enabled , map |
You can also listen to specific Drag Mode events on the map instance like this:
map.on('gm:globaldragmodetoggled', (event) => {
console.log(event);
});