iamanvesh / mapbox-gl-draw-circle

Supports drawing/editing a circle on a Mapbox map.
https://iamanvesh.github.io/mapbox-gl-draw-circle-test/
MIT License
74 stars 59 forks source link

Add draw circle to Map Control #19

Closed hnahoulder closed 4 years ago

hnahoulder commented 4 years ago

Hello,

I'm looking for how can I add the draw circle control to my map control.

I have this code

const draw = new MapboxDraw({
      displayControlsDefault: true,
      userProperties: true,
      defaultMode: 'draw_circle',
      modes: {
        ...MapboxDraw.modes,
        draw_circle  : CircleMode,
        drag_circle  : DragCircleMode,
        direct_select: DirectMode,
        simple_select: SimpleSelectMode
      }
    });

And when I switch to draw polygon, I can't switch to draw circle again because I don't have it in my Map control image

nik736 commented 4 years ago

I have the same question, did you find a solution for this yet?

ajithes111 commented 4 years ago

+1

cosminv6u commented 4 years ago

I used the solution of fxi from here https://github.com/mapbox/mapbox-gl-draw/issues/874 to customize your Draw bar however you want.

iamanvesh commented 4 years ago

This library doesn't add a new icon in the draw bar as this is an extension to the existing library by mapbox and not intended to be a replacement. You can add your own custom icon / drop-down depending on the UX and invoke the functions using click handlers. Please refer to this sample.