StateNode
See source codeTable of contents
- _currentToolIdMask
- _path
- children
- editor
- id
- initial
- isLockable
- parent
- performanceTracker
- shapeType
- type
- useCoalescedEvents
- Properties
- Methods
- addChild
- enter
- exit
- getCurrent
- getCurrentToolIdMask
- getIsActive
- getPath
- handleEvent
- onCancel
- onComplete
- onDoubleClick
- onEnter
- onExit
- onInterrupt
- onKeyDown
- onKeyRepeat
- onKeyUp
- onLongPress
- onMiddleClick
- onPointerDown
- onPointerMove
- onPointerUp
- onQuadrupleClick
- onRightClick
- onTick
- onTripleClick
- onWheel
- setCurrentToolIdMask
- transition
abstract class StateNode implements Partial<TLEventHandlers> {}Constructor
Constructs a new instance of the StateNode class
Parameters
Properties
children
optional
children?: Record<string, StateNode>editor
editor: Editorid
id: stringinitial
optional
initial?: stringisLockable
isLockable: booleanparent
parent: StateNodeperformanceTracker
performanceTracker: PerformanceTrackershapeType
optional
shapeType?: stringtype
type: 'branch' | 'leaf' | 'root'useCoalescedEvents
useCoalescedEvents: booleanMethods
addChild( )
Add a child node to this state node.
addChild(childConstructor: TLStateNodeConstructor): thisParameters
| Name | Description |
|---|---|
|
Returns
thisenter( )
enter(info: any, from: string): voidParameters
| Name | Description |
|---|---|
| |
| |
Returns
voidexit( )
exit(info: any, to: string): voidParameters
| Name | Description |
|---|---|
| |
| |
Returns
voidgetCurrent( )
This node's current active child node, if any.
getCurrent(): StateNode | undefinedgetCurrentToolIdMask( )
getCurrentToolIdMask(): string | undefinedgetIsActive( )
Whether this node is active.
getIsActive(): booleangetPath( )
This node's path of active state nodes
getPath(): stringhandleEvent( )
handleEvent(info: Exclude<TLEventInfo, TLPinchEventInfo>): voidParameters
| Name | Description |
|---|---|
| |
Returns
voidonCancel( )
optional
onCancel?(info: TLCancelEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonComplete( )
optional
onComplete?(info: TLCompleteEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonDoubleClick( )
optional
onDoubleClick?(info: TLClickEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonEnter( )
optional
onEnter?(info: any, from: string): voidParameters
| Name | Description |
|---|---|
| |
| |
Returns
voidonExit( )
optional
onExit?(info: any, to: string): voidParameters
| Name | Description |
|---|---|
| |
| |
Returns
voidonInterrupt( )
optional
onInterrupt?(info: TLInterruptEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonKeyDown( )
optional
onKeyDown?(info: TLKeyboardEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonKeyRepeat( )
optional
onKeyRepeat?(info: TLKeyboardEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonKeyUp( )
optional
onKeyUp?(info: TLKeyboardEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonLongPress( )
optional
onLongPress?(info: TLPointerEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonMiddleClick( )
optional
onMiddleClick?(info: TLPointerEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonPointerDown( )
optional
onPointerDown?(info: TLPointerEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonPointerMove( )
optional
onPointerMove?(info: TLPointerEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonPointerUp( )
optional
onPointerUp?(info: TLPointerEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonQuadrupleClick( )
optional
onQuadrupleClick?(info: TLClickEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonRightClick( )
optional
onRightClick?(info: TLPointerEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonTick( )
optional
onTick?(info: TLTickEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonTripleClick( )
optional
onTripleClick?(info: TLClickEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidonWheel( )
optional
onWheel?(info: TLWheelEventInfo): voidParameters
| Name | Description |
|---|---|
|
Returns
voidsetCurrentToolIdMask( )
setCurrentToolIdMask(id: string | undefined): voidParameters
| Name | Description |
|---|---|
| |
Returns
voidtransition( )
Transition to a new active child state node.
transition(id: string, info?: any): thisExample
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 |
Returns
thisPrev
Stadium2dNext
TextManager