Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ToolBehavior<ToolDataT>

Type parameters

  • ToolDataT

Hierarchy

Index

Accessors

behaviorType

Methods

_supportsAction

  • _supportsAction(actionName: string): boolean

isTargeted

  • isTargeted(user?: User): boolean
  • Gets whether the behavior is being targeted by the given user, or at all if no user is given.

    Parameters

    • Optional user: User

      The user to check whether they are targeting this behavior.

    Returns boolean

    True if the user is targeting this behavior, false if not. In the case where no user id is given, this returns true if any user is targeting this behavior, false if none are.

onHolding

  • onHolding(holdingState: "picked-up" | "holding" | "dropped", handler: ActionHandler<ToolDataT>): this
  • Add a holding handler to be called when the given hover state is triggered.

    Parameters

    • holdingState: "picked-up" | "holding" | "dropped"

      The holding state to fire the handler on.

    • handler: ActionHandler<ToolDataT>

      The handler to call when the holding state is triggered.

    Returns this

    This tool behavior.

onTarget

  • onTarget(targetState: "enter" | "exit", handler: ActionHandler): this

onUsing

  • onUsing(usingState: "started" | "using" | "stopped", handler: ActionHandler<ToolDataT>): this
  • Add a using handler to be called when the given hover state is triggered.

    Parameters

    • usingState: "started" | "using" | "stopped"

      The using state to fire the handler on.

    • handler: ActionHandler<ToolDataT>

      The handler to call when the using state is triggered.

    Returns this

    This tool behavior.