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
:
Method | Returns | Description |
---|---|---|
enableGlobalRemovalMode() | - | Enables global removal mode. |
disableGlobalRemovalMode() | - | Disables global removal mode. |
toggleGlobalRemovalMode() | - | Toggles global removal mode. |
globalRemovalModeEnabled() | Boolean | Returns true if global removal mode is enabled. false when disabled. |
cancelGlobalRemovalMode() | - | Reverts the layers to the state before changing. ⭐ |
The following events are available on a layer instance:
Event | Params | Description | Output |
---|---|---|---|
pm:remove | e | Fired when a layer is removed via Removal Mode | layer , shape |
pm:cancel | e | Fired when the layer changes are canceled. ⭐ | layer |
pm:undoremove | e | Fired when the layer removing is canceled and the layer is re-added to the map. ⭐ | layer |
The following events are available on a map instance:
Event | Params | Description | Output |
---|---|---|---|
pm:globalremovalmodetoggled | e | Fired when Removal Mode is toggled | enabled , map |
pm:remove | e | Fired when a layer is removed via Removal Mode | layer , shape |
layerremove | e | Standard Leaflet event. Fired when any layer is removed. | layer |
pm:globalcancel | e | Fired when cancel of a Mode is called. ⭐ | map |
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...