Skip to main content

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:

MethodReturnsDescription
enableGlobalEditMode()-Enables global Edit Mode.
disableGlobalEditMode()-Disables global Edit Mode.
toggleGlobalEditMode()-Toggles global Edit Mode.
globalEditModeEnabled()BooleanReturns true if global Edit Mode is enabled. false when disabled.

The following events are available on a map instance:

EventParamsDescriptionOutput
gm:editstarteventFired when a layer starts being changed.map, feature, shape
gm:editeventFired when a layer is being changed.map, feature, shape
gm:editendeventFired when a layer stops being changed.map, feature, shape

The following events are available on a map instance:

EventParamsDescriptionOutput
gm:globaleditmodetoggledeventFired 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);
});

Live Edit Example