coordPath: e.featureTarget.properties.coord_path,
startPos: e.lngLat
MapboxDraw.modes.direct_select.clickNoTarget = function() {
const wasSelected = this.getSelectedIds();
const wasSelectedFeatures = wasSelected.map(id => this.getFeature(id));
this.changeMode('NodeMangler', {
wasSelected,
wasSelectedFeatures
MapboxDraw.modes.direct_select.clickInactive = function() {
const wasSelected = this.getSelectedIds();
const wasSelectedFeatures = wasSelected.map(id => this.getFeature(id));
this.changeMode('NodeMangler', {
wasSelected,
wasSelectedFeatures
export function setupDraw() {
return new MapboxDraw({
displayControlsDefault: true,
clickBuffer: DRAW_CLICK_BUFFER,
doubleClickZoom: false,
controls: {
lineString: true,
polygon: true,