API Docs for: v0.1.0
Show:

Pointer Class

Represents a single pointer input method

Constructor

Pointer

(
  • id
  • manager
)

Parameters:

  • id String | Number

    The identifier for this pointer

  • manager Pointers

    The pointer manager for this pointer instance

Methods

down

(
  • evt
)

Callback for when a pointerdown event occurs

Parameters:

  • evt DOMEvent

    The original DOM Event

emit

(
  • type
  • data
)
Mixed chainable

Emits an event which will run all registered listeners for the event type

Parameters:

  • type String

    The event name to emit

  • data Mixed

    Any data you want passed along with the event

Returns:

Mixed:

Returns itself.

leave

(
  • evt
)

Callback for when a pointerleave event occurs

Parameters:

  • evt DOMEvent

    The original DOM Event

move

(
  • evt
)

Callback for when a pointermove event occurs

Parameters:

  • evt DOMEvent

    The original DOM Event

off

(
  • type
  • listener
)
Mixed chainable

Removes a listener function for an event type

Parameters:

  • type String

    The event name to emit

  • listener Function

    The function to remove

Returns:

Mixed:

Returns itself.

on

(
  • type
  • listener
)
Mixed chainable

Registers a listener function to be run on an event occurance

Parameters:

  • type String

    The event name to listen for

  • listener Function

    The function to execute when the event happens

Returns:

Mixed:

Returns itself.

once

(
  • type
  • listener
)
Mixed chainable

Registers a one-time callback for an event

Parameters:

  • type String

    The event name to listen for

  • listener Function

    the callback to call when the event occurs

Returns:

Mixed:

Returns itself.

up

(
  • evt
)

Callback for when a pointerup event occurs

Parameters:

  • evt DOMEvent

    The original DOM Event

update

(
  • dt
)
private

Called internally every frame. Updates the pointer

Parameters:

  • dt Number

    The delta time (in seconds) since the last update

Properties

_holdSent

Boolean private

Have we emitted the hold event already?

active

Boolean

Is this an active pointer (currently touching)?

button

Number

The button on the pointer being pressed

clock

Clock private

The clock for timing stuffz

game

Game

Inherited from Input but overwritten in src\input\pointer\Pointer.js:36

The game instance of the pointer

id

String | Number

The id of this pointer

manager

Pointers

The pointer's manager

mouse

Boolean

Is this the mouse pointer?

positionWorld

Object

Contains the X/Y position in the world of the pointer object

type

TYPE

The type of the pointer

TYPE

Object

The type of a pointer