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. |
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 |
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 |
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...