It used to also own a dispatcher: useTools constructed the tool-routing
dispatcher and <Canvas> pumped DOM events into it. Input now belongs
entirely to useGestureDispatcher, so what's left here is slot state plus
the overlay roll-up.
Requires <ActiveToolContextProvider> (or <WeaselProvider> /
<SceneCanvas>, which mount one internally) in scope: active/hotkey state
lives in the context so the gesture dispatcher and any sibling
useTools calls all read the same source of truth.
First-mount-wins semantics: if opts.active differs from the context
default ('select') on first mount, useTools pushes opts.active to
the context via a microtask. Subsequent mounts respect whatever the
context currently holds (the first caller wins).
Manages the active tool and hotkey slot.
It used to also own a dispatcher:
useToolsconstructed the tool-routing dispatcher and<Canvas>pumped DOM events into it. Input now belongs entirely touseGestureDispatcher, so what's left here is slot state plus the overlay roll-up.Requires
<ActiveToolContextProvider>(or<WeaselProvider>/<SceneCanvas>, which mount one internally) in scope: active/hotkey state lives in the context so the gesture dispatcher and any siblinguseToolscalls all read the same source of truth.First-mount-wins semantics: if
opts.activediffers from the context default ('select') on first mount,useToolspushesopts.activeto the context via a microtask. Subsequent mounts respect whatever the context currently holds (the first caller wins).