Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ButtonBehavior

Button behavior class containing the target behavior actions.

Hierarchy

Index

Accessors

behaviorType

  • get behaviorType(): "none" | "target" | "button"

click

hover

Methods

isClicked

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

    Parameters

    • Optional userId: string

      The id of 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(userId?: string): boolean
  • Gets whether the button is being hovered over by the given user, or at all if no user id is given.

    Parameters

    • Optional userId: string

      The id of 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.

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.