iamanvesh / mapbox-gl-draw-circle

Supports drawing/editing a circle on a Mapbox map.
https://iamanvesh.github.io/mapbox-gl-draw-circle-test/
MIT License
74 stars 59 forks source link

Unable to set default radius #56

Open its-aazizi opened 1 year ago

its-aazizi commented 1 year ago
import MapboxDraw from "@mapbox/mapbox-gl-draw";
import { CircleMode, DirectMode, DragCircleMode, SimpleSelectMode } from "mapbox-gl-draw-circle";

const draw = new MapboxDraw({
    displayControlsDefault: false,
    defaultMode: "draw_circle",
    userProperties: true,
    modes: {
        ...MapboxDraw.modes,
        draw_circle: CircleMode,
        drag_circle: DragCircleMode,
        direct_select: DirectMode,
        simple_select: SimpleSelectMode
    }
});

draw.changeMode("draw_circle", { initialRadiusKm: 0.001 });

leads to the following error: TypeError: Cannot read properties of undefined (reading 'changeMode')

james-astra commented 7 months ago

Same here