Edit Mode
You can handle Edit Mode for all layers on a map like this:
map.gm.enableGlobalEditMode();
map.gm.disableGlobalEditMode();
map.gm.toggleGlobalEditMode();
map.gm.globalEditModeEnabled();
// Or like this:
map.gm.enableMode('edit', 'change');
map.gm.disableMode('edit', 'change');
map.gm.toggleMode('edit', 'change');
map.gm.isModeEnabled('edit', 'change');
The following methods are available on map.gm
:
Method | Returns | Description |
---|---|---|
enableGlobalEditMode() | - | Enables global Edit Mode. |
disableGlobalEditMode() | - | Disables global Edit Mode. |
toggleGlobalEditMode() | - | Toggles global Edit Mode. |
globalEditModeEnabled() | Boolean | Returns true if global Edit Mode is enabled. false when disabled. |
The following events are available on a map instance:
Event | Params | Description | Output |
---|---|---|---|
gm:editstart | event | Fired when a layer starts being changed. | map , feature , shape |
gm:edit | event | Fired when a layer is being changed. | map , feature , shape |
gm:editend | event | Fired when a layer stops being changed. | map , feature , shape |
The following events are available on a map instance:
Event | Params | Description | Output |
---|---|---|---|
gm:globaleditmodetoggled | event | Fired when Edit Mode is toggled. | enabled , map |
You can also listen to specific Edit Mode events on the map instance like this:
map.on('gm:globaleditmodetoggled', (event) => {
console.log(event);
});