Table of contents
abstract class StateNode implements Partial<TLEventHandlers> {}

Constructor

Constructs a new instance of the StateNode class

Parameters
NameDescription

editor

Editor

parent

StateNode

Properties



children

children?: Record<string, StateNode>

editor

editor: Editor

enter

enter: (info: any, from: string) => void

exit

exit: (info: any, from: string) => void

handleEvent

handleEvent: (info: Exclude<TLEventInfo, TLPinchEventInfo>) => void

id

id: string

initial

initial?: string

onCancel

onCancel?: TLEventHandlers['onCancel']

onComplete

onComplete?: TLEventHandlers['onComplete']

onDoubleClick

onDoubleClick?: TLEventHandlers['onDoubleClick']

onEnter

onEnter?: TLEnterEventHandler

onExit

onExit?: TLExitEventHandler

onInterrupt

onInterrupt?: TLEventHandlers['onInterrupt']

onKeyDown

onKeyDown?: TLEventHandlers['onKeyDown']

onKeyRepeat

onKeyRepeat?: TLEventHandlers['onKeyRepeat']

onKeyUp

onKeyUp?: TLEventHandlers['onKeyUp']

onLongPress

onLongPress?: TLEventHandlers['onLongPress']

onMiddleClick

onMiddleClick?: TLEventHandlers['onMiddleClick']

onPointerDown

onPointerDown?: TLEventHandlers['onPointerDown']

onPointerMove

onPointerMove?: TLEventHandlers['onPointerMove']

onPointerUp

onPointerUp?: TLEventHandlers['onPointerUp']

onQuadrupleClick

onQuadrupleClick?: TLEventHandlers['onQuadrupleClick']

onRightClick

onRightClick?: TLEventHandlers['onRightClick']

onTick

onTick?: TLEventHandlers['onTick']

onTripleClick

onTripleClick?: TLEventHandlers['onTripleClick']

onWheel

onWheel?: TLEventHandlers['onWheel']

parent

parent: StateNode

performanceTracker

performanceTracker: PerformanceTracker

shapeType

shapeType?: string

transition

Transition to a new active child state node.

transition: (id: string, info?: any) => this
Example
parentState.transition('childStateA')
parentState.transition('childStateB', { myData: 4 })
Parameters
NameDescription

id

The id of the child state node to transition to.

info

Any data to pass to the onEnter and onExit handlers.


type

type: 'branch' | 'leaf' | 'root'

Methods

getCurrent()

This node's current active child node, if any.

getCurrent(): StateNode | undefined

getCurrentToolIdMask()

getCurrentToolIdMask(): string | undefined

getIsActive()

Whether this node is active.

getIsActive(): boolean

getPath()

This node's path of active state nodes

getPath(): string

setCurrentToolIdMask()

setCurrentToolIdMask(id: string | undefined): void
Parameters
NameDescription

id

string | undefined
Returns
void

Stadium2dstopEventPropagation