SDK JS
    Preparing search index...

    The shared draw-interaction binder. Create once per tool; call DrawController.start to begin a shape and DrawController.dispose on widget teardown.

    import { DrawController, pickScenePosition } from '@bitruvius/sdk-maplibre';

    const draw = new DrawController({
    map,
    pickFn: (x, y) => pickScenePosition(map, [buildings], x, y),
    onChange: (state) => {
    if (state.phase === 'done') console.log(state.vertices);
    },
    });
    draw.start('polyline'); // click to add vertices; dblclick or Enter finishes, Escape cancels
    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    Methods

    • Abandon the current shape — back to idle, keeping the mode (a finished shape is discarded too).

      Returns void

    • Clear everything back to idle.

      Returns void

    • Apply an action (the single mutation path) and notify.

      Parameters

      Returns void

    • Unbind all listeners (widget teardown).

      Returns void

    • Begin drawing a new shape (clears any previous one).

      Parameters

      • mode: "polyline" | "polygon"

      Returns void