Skip to content

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

Notifications You must be signed in to change notification settings

BrunoSalerno/mapbox-gl-draw-cut-line-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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.

Build

yarn build will do it.

License

MIT

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published