LineShapeTool

See source code
Table of contents

Extends StateNode.

class LineShapeTool extends StateNode {}

Constructor

Constructs a new instance of the StateNode class

Parameters

NameDescription

editor

parent


Properties

id

static
static id: string

initial

static
static initial: string



children

optional
children?: Record<string, StateNode>

editor

editor: Editor

isLockable

isLockable: boolean

parent

parent: StateNode

performanceTracker

performanceTracker: PerformanceTracker

shapeType

shapeType: string

type

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

Methods

children()

static
static children(): TLStateNodeConstructor[]

enter()

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

Parameters

NameDescription

info

any

from

string

Returns

void

exit()

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

Parameters

NameDescription

info

any

from

string

Returns

void

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

handleEvent()

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

Parameters

NameDescription

info

Returns

void

onCancel()

optional
onCancel?(info: TLCancelEventInfo): void

Parameters

NameDescription

info

Returns

void

onComplete()

optional
onComplete?(info: TLCompleteEventInfo): void

Parameters

NameDescription

info

Returns

void

onDoubleClick()

optional
onDoubleClick?(info: TLClickEventInfo): void

Parameters

NameDescription

info

Returns

void

onEnter()

optional
onEnter?(info: any, from: string): void

Parameters

NameDescription

info

any

from

string

Returns

void

onExit()

optional
onExit?(info: any, to: string): void

Parameters

NameDescription

info

any

to

string

Returns

void

onInterrupt()

optional
onInterrupt?(info: TLInterruptEventInfo): void

Parameters

NameDescription

info

Returns

void

onKeyDown()

optional
onKeyDown?(info: TLKeyboardEventInfo): void

Parameters

NameDescription

info

Returns

void

onKeyRepeat()

optional
onKeyRepeat?(info: TLKeyboardEventInfo): void

Parameters

NameDescription

info

Returns

void

onKeyUp()

optional
onKeyUp?(info: TLKeyboardEventInfo): void

Parameters

NameDescription

info

Returns

void

onLongPress()

optional
onLongPress?(info: TLPointerEventInfo): void

Parameters

NameDescription

info

Returns

void

onMiddleClick()

optional
onMiddleClick?(info: TLPointerEventInfo): void

Parameters

NameDescription

info

Returns

void

onPointerDown()

optional
onPointerDown?(info: TLPointerEventInfo): void

Parameters

NameDescription

info

Returns

void

onPointerMove()

optional
onPointerMove?(info: TLPointerEventInfo): void

Parameters

NameDescription

info

Returns

void

onPointerUp()

optional
onPointerUp?(info: TLPointerEventInfo): void

Parameters

NameDescription

info

Returns

void

onQuadrupleClick()

optional
onQuadrupleClick?(info: TLClickEventInfo): void

Parameters

NameDescription

info

Returns

void

onRightClick()

optional
onRightClick?(info: TLPointerEventInfo): void

Parameters

NameDescription

info

Returns

void

onTick()

optional
onTick?(info: TLTickEventInfo): void

Parameters

NameDescription

info

Returns

void

onTripleClick()

optional
onTripleClick?(info: TLClickEventInfo): void

Parameters

NameDescription

info

Returns

void

onWheel()

optional
onWheel?(info: TLWheelEventInfo): void

Parameters

NameDescription

info

Returns

void

setCurrentToolIdMask()

setCurrentToolIdMask(id: string | undefined): void

Parameters

NameDescription

id

string | undefined

Returns

void

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

string

The id of the child state node to transition to.

info

any

Any data to pass to the onEnter and onExit handlers.

Returns

this

Prev
LaserTool
Next
LineShapeUtil