Skip to main content

Removal Mode

Removal Mode

You can enable Removal Mode for all layers on a map like this:

// enable removal mode like this:
map.pm.enableGlobalRemovalMode();

The following methods are available on map.pm:

MethodReturnsDescription
enableGlobalRemovalMode()-Enables global removal mode.
disableGlobalRemovalMode()-Disables global removal mode.
toggleGlobalRemovalMode()-Toggles global removal mode.
globalRemovalModeEnabled()BooleanReturns true if global removal mode is enabled. false when disabled.

The following events are available on a layer instance:

EventParamsDescriptionOutput
pm:removeeFired when a layer is removed via Removal Modelayer, shape

The following events are available on a map instance:

EventParamsDescriptionOutput
pm:globalremovalmodetoggledeFired when Removal Mode is toggledenabled, map
pm:removeeFired when a layer is removed via Removal Modelayer, shape
layerremoveeStandard Leaflet event. Fired when any layer is removed.layer

You can also listen to specific removal mode events on the map instance like this:

map.on("pm:globalremovalmodetoggled", (e) => {
console.log(e);
});

Example

Loading...