Skip to content

Custom mode for Mapbox GL Draw that adds the functionality to draw rectangles

Notifications You must be signed in to change notification settings

hexin333/mapbox-gl-draw-rectangle-mode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mapbox GL Draw Rectangle Mode

This is a custom mode for Mapbox GL Draw that adds the functionality to draw rectangles

Install

yarn add mapbox-gl-draw-rectangle-mode

Demo

https://bl.ocks.org/erick-otenyo/e22cefb2c69fb4d4db4c19d7778ed574

Usage

import DrawRectangle from 'mapbox-gl-draw-rectangle-mode';

const modes = MapboxDraw.modes;
modes.draw_rectangle = DrawRectangle;

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

draw.changeMode('draw_rectangle');

Once a rectangle is created, 1 event is fired:

  • draw.create with the created rectangle

Build

yarn build will do it.

License

MIT

About

Custom mode for Mapbox GL Draw that adds the functionality to draw rectangles

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%