TheDocumentation Index
Fetch the complete documentation index at: https://docs.tsdraw.com/llms.txt
Use this file to discover all available pages before exploring further.
InputManager in @tsdraw/core normalizes raw browser events into a consistent format that tools can consume.
Pointer events
All mouse, touch, and pen events are unified through thePointerInput type:
Event routing
Events flow through this chain:- DOM event fires on the canvas element
- InputManager normalizes the event into a
PointerInput - ToolManager routes the event to the active tool’s current state
- StateNode handles the event (e.g. start drawing, move a shape, erase)
Pressure handling
For stylus input, thepressure field ranges from 0 to 1. Mouse and finger input default to 0.5.
The pen tool records pressure in each point’s z value, which the renderer uses to vary stroke width.
Modifier keys
Tools can respond to modifier keys (Shift, Ctrl/Cmd, Alt) through themodifiers object on pointer events. For example, holding Shift while using the select tool could constrain movement to one axis.
Focus management
The canvas captures focus when clicked. TheautoFocus prop controls whether the canvas takes focus on mount:
Read-only mode
WhenreadOnly is true, pointer events still fire but drawing and erasing tools are disabled. The hand tool remains active for panning.