Skip to content

Instantly share code, notes, and snippets.

View benderlidze's full-sized avatar

Serg benderlidze

  • Lviv
View GitHub Profile
@benderlidze
benderlidze / RadiusMode.js
Created March 7, 2021 13:21 — forked from chriswhong/RadiusMode.js
RadiusMode, a custom mode for mapbox-gl-draw for drawing a radius
// custom mapbopx-gl-draw mode that modifies draw_line_string
// shows a center point, radius line, and circle polygon while drawing
// forces draw.create on creation of second vertex
import MapboxDraw from 'mapbox-gl-draw';
import numeral from 'numeral';
import lineDistance from 'npm:@turf/line-distance';
const RadiusMode = MapboxDraw.modes.draw_line_string;