3

I'm using https://github.com/mapbox/mapbox-gl-draw for draw tools, and it by default sets the control position to the top right. Like so: enter image description here

It seems like it's possible to change the position of the control by setting an option, but I cannot figure out how to do so. I've been looking through the source and the documentation.

Ben Rudolph
  • 2,509
  • 2
  • 19
  • 26

2 Answers2

4

you can set the position in the addControl method.

var Draw = new MapboxDraw();

map.addControl(Draw, 'bottom-left');
mollymerp
  • 1,542
  • 9
  • 14
  • Thanks, for some reason thought that would be controlled by the Draw. But makes sense that the map handles the positioning. – Ben Rudolph Jan 26 '18 at 01:40
  • 1
    Yep it's a little confusing. I added more information in the example here https://github.com/mapbox/mapbox-gl-draw#usage-in-your-application – mollymerp Jan 26 '18 at 18:31
2

addControl( control, position )

Parameters

position(string?), position on the map to which the control will be added. Valid values are

  • 'top-left'
  • 'top-right'
  • 'bottom-left'
  • 'bottom-right'

Defaults to 'top-right'

Example App

antelove
  • 3,216
  • 26
  • 20