Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ButtonBehavior

Button behavior class containing the target behavior actions.

Hierarchy

Index

Accessors

behaviorType

click

hover

target

Methods

_supportsAction

  • _supportsAction(actionName: string): boolean

isClicked

  • isClicked(user?: User): boolean
  • Gets whether the button is being clicked by the given user, or at all if no user id is given.

    Parameters

    • Optional user: User

      The user to check whether they are clicking this button behavior.

    Returns boolean

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

isHoveredOver

  • isHoveredOver(user?: User): boolean
  • Gets whether the button is being hovered over by the given user, or at all if no user id is given.

    Parameters

    • Optional user: User

      The user to check whether they are hovering over this button behavior.

    Returns boolean

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

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.

onClick

  • onClick(clickState: "pressed" | "released", handler: ActionHandler): this
  • Add a click handler to be called when the given click state is triggered.

    Parameters

    • clickState: "pressed" | "released"

      The click state to fire the handler on.

    • handler: ActionHandler

      The handler to call when the click state is triggered.

    Returns this

    This button behavior.

onHover

  • onHover(hoverState: "enter" | "exit", handler: ActionHandler): this
  • Add a hover handler to be called when the given hover state is triggered.

    Parameters

    • hoverState: "enter" | "exit"

      The hover state to fire the handler on.

    • handler: ActionHandler

      The handler to call when the hover state is triggered.

    Returns this

    This button behavior.

onTarget

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