useDraw
The state of the Draw tool: the shapes, what is selected, undo, and every way to change them, by pointer and by keyboard.
This is a function exported by @mapcairn/map, checked against version 0.2.0.
Signature
import { useDraw } from "@mapcairn/map";
function useDraw(input: UseDrawOptions): UseDraw;
Parameters
{ units, active, getAdapter, }input(UseDrawOptions)
Returns
UseDraw
Remarks
The pure rules live in core (drawReducer and friends). This hook
adds what needs the map and the ports: the map centre and projection for
"at map centre", nudges and shape picking; the announcer; the file saver
and the clipboard for export; and the address for a link with shapes.
Shapes belong to the app, not to the toolbar, so they stay on the map when
the tool closes. Nothing is stored, and nothing reaches the address bar:
shapes are read once, from a link that carries them, and written only into
the link UseDraw builds.
Announcements follow the reducer's lastEvent, so a drag that moves a
vertex many times is announced once, DRAW_ANNOUNCE_DELAY_MS after
it settles, and a refusal is announced assertively.