Split Mode
Split Mode allows you to draw a line that splits all underlying Polygons and Lines. When a feature is split, the original feature will be replaced with the resulting split features.
You can handle Split Mode for all layers on a map like this:
map.gm.enableGlobalSplitMode();
map.gm.disableGlobalSplitMode();
map.gm.toggleGlobalSplitMode();
map.gm.globalSplitModeEnabled();
// Or like this:
map.gm.enableMode('edit', 'split');
map.gm.disableMode('edit', 'split');
map.gm.toggleMode('edit', 'split');
map.gm.isModeEnabled('edit', 'split');
The following methods are available on map.gm
:
Method | Returns | Description |
---|---|---|
enableGlobalSplitMode() | - | Enables global Split Mode. |
disableGlobalSplitMode() | - | Disables global Split Mode. |
toggleGlobalSplitMode() | - | Toggles global Split Mode. |
globalSplitModeEnabled() | Boolean | Returns true if global Split Mode is enabled. false when disabled. |
The following events are available on a map instance:
Event | Params | Description | Output |
---|---|---|---|
gm:split | event | Fired during the split operation. | map , originalFeature , features |
gm:create | event | Fired during the split operation. | map , feature , shape |
The following events are available on a map instance:
Event | Params | Description | Output |
---|---|---|---|
gm:globalsplitmodetoggled | event | Fired when Split Mode is toggled. | enabled , map |
You can also listen to specific Split Mode events on the map instance like this:
map.on('gm:globalsplitmodetoggled', (event) => {
console.log(event);
});
Behavior
Split mode operates by:
- Drawing a line across features you want to split
- The line will split any intersecting polygons or lines into separate features
- Original features are replaced with the resulting split features