react-mapbox-draw-rectangle
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

react-mapbox-draw-rectangle

Travis npm package Coveralls

Installation

yarn add react-mapbox-draw-rectangle

Demo

Usage

<Map
style="mapbox://styles/mapbox/streets-v9" // eslint-disable-line
containerStyle={{
	height: '600px',
	width: '100vw'
}}
>
	<DrawControl
		userProperties={true}
		position={'top-right'}
		//controls={{ polygon: true, trash: true }}
		displayControlsDefault={false}
		modes={{
			draw_rectangle: DrawRectangle,
		}}
		modesConfig={{
			draw_rectangle: {
				areaLimit: 50 * 1_000_000, // 50+ km2, optional
				escapeKeyStopsDrawing: true, // default true
				allowCreateExceeded: false, // default false
				exceedCallsOnEachMove: false, // default false - calls exceedCallback on each mouse move
				//exceedCallback: (area) => console.log(`area exceeded! ${area.toFixed(2)}`), // optional
				//areaChangedCallback: onAreaChanged,
				title: "Rectangle tool (p)"
			}
		}}
		styles={DrawStyles}
		onDrawCreate={onDrawCreate}
	></DrawControl>
</Map>

References

Package Sidebar

Install

npm i react-mapbox-draw-rectangle

Weekly Downloads

0

Version

0.0.5

License

MIT

Unpacked Size

9.09 kB

Total Files

5

Last publish

Collaborators

  • appwrk