Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/brunosalerno/mapbox-gl-draw-cut-line-mode

This is a custom mode for Mapbox GL Draw 1.x that adds the LineString cutting/splitting functionality
https://github.com/brunosalerno/mapbox-gl-draw-cut-line-mode

Last synced: 1 day ago
JSON representation

This is a custom mode for Mapbox GL Draw 1.x that adds the LineString cutting/splitting functionality

Awesome Lists containing this project

README

        

## Mapbox GL Draw Cut Line Mode

This is a custom mode for Mapbox GL Draw 1.x that adds the LineString cutting/splitting functionality

### Install

`yarn add mapbox-gl-draw-cut-line-mode`

### Usage

```js
import CutLineMode from 'mapbox-gl-draw-cut-line-mode';

const modes = MapboxDraw.modes;
modes.cut_line = CutLineMode;

const draw = new MapboxDraw({
modes: modes
});

draw.changeMode('cut_line');
```

Once a feature is splitted, 2 events are fired:
- `draw.delete` with the id of the deleted feature
- `draw.create` with the new (children) features

See a full example in the [example folder](example/).

### Build

`yarn build` will do it.

### License

MIT