Skip to content

Instantly share code, notes, and snippets.

Avatar

Austin Birch austinbirch

View GitHub Profile
@austinbirch
austinbirch / RadiusMode.js
Created Sep 14, 2020 — forked from chriswhong/RadiusMode.js
RadiusMode, a custom mode for mapbox-gl-draw for drawing a radius
View RadiusMode.js
// 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;