StateNode
Table of contents
- _currentToolIdMask
- _path
- children
- editor
- enter
- exit
- handleEvent
- id
- initial
- isLockable
- onCancel
- onComplete
- onDoubleClick
- onEnter
- onExit
- onInterrupt
- onKeyDown
- onKeyRepeat
- onKeyUp
- onLongPress
- onMiddleClick
- onPointerDown
- onPointerMove
- onPointerUp
- onQuadrupleClick
- onRightClick
- onTick
- onTripleClick
- onWheel
- parent
- performanceTracker
- shapeType
- transition
- type
- Properties
- Methods
abstract class StateNode implements Partial<TLEventHandlers> {}
Constructs a new instance of the StateNode
class
Parameters
Properties
children?: Record<string, StateNode>
editor: Editor
enter: (info: any, from: string) => void
exit: (info: any, from: string) => void
handleEvent: (info: Exclude<TLEventInfo, TLPinchEventInfo>) => void
id: string
initial?: string
isLockable: boolean
onCancel?: TLEventHandlers['onCancel']
onComplete?: TLEventHandlers['onComplete']
onDoubleClick?: TLEventHandlers['onDoubleClick']
onEnter?: TLEnterEventHandler
onExit?: TLExitEventHandler
onInterrupt?: TLEventHandlers['onInterrupt']
onKeyDown?: TLEventHandlers['onKeyDown']
onKeyRepeat?: TLEventHandlers['onKeyRepeat']
onKeyUp?: TLEventHandlers['onKeyUp']
onLongPress?: TLEventHandlers['onLongPress']
onMiddleClick?: TLEventHandlers['onMiddleClick']
onPointerDown?: TLEventHandlers['onPointerDown']
onPointerMove?: TLEventHandlers['onPointerMove']
onPointerUp?: TLEventHandlers['onPointerUp']
onQuadrupleClick?: TLEventHandlers['onQuadrupleClick']
onRightClick?: TLEventHandlers['onRightClick']
onTick?: TLEventHandlers['onTick']
onTripleClick?: TLEventHandlers['onTripleClick']
onWheel?: TLEventHandlers['onWheel']
parent: StateNode
performanceTracker: PerformanceTracker
shapeType?: string
Transition to a new active child state node.
transition: (id: string, info?: any) => this
Example
parentState.transition('childStateA')
parentState.transition('childStateB', { myData: 4 })
Parameters
Name | Description |
---|---|
| The id of the child state node to transition to. |
| Any data to pass to the |
type: 'branch' | 'leaf' | 'root'
Methods
This node's current active child node, if any.
getCurrent(): StateNode | undefined
getCurrentToolIdMask(): string | undefined
Whether this node is active.
getIsActive(): boolean
This node's path of active state nodes
getPath(): string
setCurrentToolIdMask(id: string | undefined): void
Parameters
Name | Description |
---|---|
|
|
Returns
void