mapbox-gl-draw-rectangle-mode

1.0.4 • Public • Published

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/andrewharvey/31b8180e3f5f1e12849a352796e0daf4

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 events is fired:

  • draw.create with the created rectangle

Build

yarn build will do it.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i mapbox-gl-draw-rectangle-mode

Weekly Downloads

9,722

Version

1.0.4

License

MIT

Unpacked Size

72.5 kB

Total Files

6

Last publish

Collaborators

  • erick-otenyo