mapbox-gl-draw-square-mode
v1.0.4
Published
A custom mode for MapboxGL Draw to draw squares
Downloads
2
Readme
Mapbox GL Draw Rectangle Mode
This is a custom mode for Mapbox GL Draw that adds the functionality to draw squares
Install
yarn add mapbox-gl-draw-square-mode
Demo
https://bl.ocks.org/erick-otenyo/e22cefb2c69fb4d4db4c19d7778ed574
Usage
import DrawSquare from 'mapbox-gl-draw-square-mode';
const modes = MapboxDraw.modes;
modes.draw_square = DrawSquare;
const draw = new MapboxDraw({
modes: modes
});
draw.changeMode('draw_square');
Once a square is created, 1 event is fired:
draw.create
with the created square
Build
yarn build
will do it.
License
MIT