amaury1093 / react-mapbox-gl-draw

Draw tools for Mapbox with React: 🗺️ react-mapbox-gl + 🖌️ mapbox-gl-draw
MIT License
183 stars 28 forks source link

How to create custom controls? #44

Closed mattoni closed 4 years ago

mattoni commented 4 years ago

Hi there,

I'm attempting to create custom buttons to trigger draw effects, but I can't seem to find how to do that...probably missing something simple but any help would be appreciated.

Thanks!

LiliGuimaraes commented 4 years ago

Hellow,

I'm stock in the same problem. I need to styled my own toolbar with geometries draw functionalities, but I can't find in MapBox API how to implement this in the

amaury1093 commented 4 years ago

If you're talking about what Mapbox calls "Custom Modes", then:

1/ Create your own mode following this tutorial: https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/MODES.md

2/

const LotsOfPointsMode = {...}; // Created following the tutorial above

// in render:
<DrawControl
  modes={{ lotsOfPoints: LotsOfPointsMode }}
/>