Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UIButton

A simple UI button that can track clicks and hovers

Hierarchy

  • UI
    • UIButton

Index

Constructors

constructor

Properties

Protected _actions

_actions: object

Type declaration

_clicks

_clicks: number = 0

Protected _id

_id: string

Protected _states

_states: object

Type declaration

  • [key: string]: any

group

group: Group

shape

shape: UIShape

Accessors

clicks

  • get clicks(): number
  • Get the total number of clicks on this UIButton

    Returns number

id

  • get id(): string
  • set id(d: string): void
  • Get and set uique id

    Returns string

  • Get and set uique id

    Parameters

    • d: string

    Returns void

Methods

Protected _trigger

  • _trigger(p: Pt): boolean
  • Check intersection using a specific function based on UIShape

    Parameters

    • p: Pt

      a point to check

    Returns boolean

listen

  • listen(key: string, p: Pt): boolean
  • Listen for interactions and trigger action handlers

    Parameters

    • key: string

      action key

    • p: Pt

      point to check

    Returns boolean

off

  • off(key: string): this
  • Remove an event handler

    Parameters

    • key: string

      even key

    Returns this

on

  • Add an event handler

    Parameters

    • key: string

      event key

    • fn: UIHandler

      handler function

    Returns this

onClick

  • Add a click handler

    Parameters

    Returns void

onHover

  • Add hover handler

    Parameters

    • over: UIHandler

      a function to handle when pointer enters hover

    • out: UIHandler

      a function to handle when pointer exits hover

    Returns void

render

  • render(fn: function): void
  • Take a custom render function to render this UI

    Parameters

    • fn: function

      render function

        • (group: Group, states: object): void
        • Parameters

          • group: Group
          • states: object
            • [key: string]: any

          Returns void

    Returns void

state

  • state(key: string): any
  • Get a state

    Parameters

    • key: string

      state's name

    Returns any

Generated using TypeDoc