Class ToolStateModule

EntityBase.

Hierarchy (view full)

Implements

Constructors

Properties

_app?: App
_destroyed: boolean = false
_rootState: StateNode
appRenderIndex: number = 0
data: ShallowReactive<{
    [key: string]: any;
}> = ...

Type declaration

  • [key: string]: any
extData: {
    [key: string]: any;
} = {}

Type declaration

  • [key: string]: any
instanceId: number = ++AppObject._instanceIdCounter
onSetApp: Signal = ...
moduleName: string = "ToolStateModule"

Accessors

  • get app(): App
  • Returns App

  • set app(value): void
  • Parameters

    Returns void

  • get destroyed(): boolean
  • Whether it has been destroyed.

    Returns boolean

  • get enabled(): boolean
  • Indicates whether the component is enabled.

    Returns boolean

  • set enabled(value): void
  • Parameters

    • value: boolean

    Returns void

Methods

  • Parameters

    • toClassInst: any
    • Optional methodNames: string[]
    • Optional addMethods: string[]
    • Optional filterName: string[]

    Returns void

  • 触发指定事件名称.

    Parameters

    • event: string

      Event name

    • Rest ...data: any

      Data

    Returns boolean

    • Whether the dispatching is successful
  • 返回注册的所有事件名.

    Returns string[]

    所有事件名

  • The id of the current selected tool.

    Returns string

  • Get a descendant by its path.

    Type Parameters

    Parameters

    • path: string

      The descendant's path of state ids, separated by periods.

    Returns T

    Example

    app.getStateDescendant('select')
    app.getStateDescendant('select.brushing')
  • The editor's current path of active states.

    Returns string

    Example

    app.getStatePath() // "draw.idle"
    
  • 确定是否存在事件侦听

    Parameters

    • event: string

      事件名

    Returns boolean

    返回是否存在相应的事件

  • 判断当前是否有工具处于运行中

    Returns boolean

  • 是否正在交互

    Returns boolean

  • 返回具有指定事件名称的侦听总数.

    Parameters

    • event: string

      Event name

    Returns number

    The count of listeners

  • 通过事件名移除所有监听.

    Parameters

    • Optional event: string

      Event name, delete all events if not passed

    Returns void

  • Set the selected tool.

    Parameters

    • Optional id: string

      The id of the tool to select.

    • Optional info: Record<string, any>

      Arbitrary data to pass along into the transition.

    Returns App

    Example

    app.setCurrentTool('transform')
    app.setCurrentTool("draw.drawpolygon", {color: 0xff0000})
  • Get whether the state node is in any of the given active paths.

    Parameters

    • Rest ...paths: string[]

    Returns boolean

    Example

    app.stateInAny('draw', 'pick')
    app.stateInAny('draw.drawpoint', 'pick.idle')
  • Get whether a certain tool (or other state node) is currently active.

    Parameters

    • path: string

      The path of active states, separated by periods.

    Returns boolean

    Example

    app.stateIsIn('draw')
    app.stateIsIn('draw.drawpoint')