Steve Bennett
Steve Bennett

Reputation: 126305

Manually fire the Mapbox-GL-Draw drawing mode

I'd like to use Mapbox-GL-Draw in an app, but want to trigger polygon drawing from a button that exists outside the Mapbox map container, and not display the normal drawing control.

A hacky way to do this would be to simply move the button after it's created, but is there a simple, cleanish way to start the drawing process?

Upvotes: 1

Views: 2200

Answers (1)

Steve Bennett
Steve Bennett

Reputation: 126305

Oh, it looks like the answer is as simple as:

drawControl.changeMode('draw_polygon');

Upvotes: 5

Related Questions