Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
API reference for the tool system
import { ToolManager } from '@tsdraw/core'
ToolManager
registerTool(definition)
setCurrentTool(id)
getCurrentToolId()
interface ToolDefinition { id: ToolId initialStateId: string stateConstructors: StateNodeConstructor[] }
id
initialStateId
stateConstructors
StateNode
type ToolId = string type DefaultToolId = 'pen' | 'eraser' | 'select' | 'hand' | 'square' | 'circle'
onEnter(info)
ToolStateTransitionInfo
onExit(info)
onPointerDown(info)
ToolPointerDownInfo
onPointerMove(info)
ToolPointerMoveInfo
onPointerUp(info)
onKeyDown(info)
ToolKeyInfo
onKeyUp(info)
interface ToolStateContext { editor: Editor transition: (stateId: string) => void }
interface ToolPointerDownInfo { context: ToolStateContext pagePoint: Vec3 screenPoint: Vec3 } interface ToolPointerMoveInfo { context: ToolStateContext pagePoint: Vec3 screenPoint: Vec3 } interface ToolKeyInfo { context: ToolStateContext key: string shiftKey: boolean ctrlKey: boolean altKey: boolean metaKey: boolean }