Class: MSPointer

Phaser. MSPointer

new MSPointer(game)

The MSPointer class handles pointer interactions with the game via the Pointer Events API. (It's named after the nonstandard MSPointerEvent, ancestor of the current API.)

It's currently supported in IE 10+, Edge, Chrome (including Android), and Opera.

You should not normally access this class directly, but instead use a Phaser.Pointer object which normalises all game input for you including accurate button handling.

Phaser does not yet support chorded button interactions.

You can disable Phaser's use of Pointer Events by any of three ways:

new Phaser.Game({ mspointer: false });
// **Before** `new Phaser.Game(…)`:
Phaser.Device.onInitialized.add(function () {
    this.mspointer = false;
});
// Once, in the earliest State `init` or `create` callback (e.g., Boot):
this.input.mspointer.stop();
Parameters:
Name Type Description
game Phaser.Game

A reference to the currently running game.

Source:
src/input/MSPointer.js line 39

Members

<readonly> active : boolean

Whether the input handler is active.

Type:
  • boolean
Source:
src/input/MSPointer.js line 113

callbackContext : object

The context under which callbacks are called (defaults to game).

Type:
  • object
Source:
src/input/MSPointer.js line 56

capture : boolean

If true the PointerEvent will call preventDefault(), canceling the corresponding MouseEvent or TouchEvent.

If the Mouse handler is active as well, you should set this to true to avoid duplicate events.

"Mouse events can only be prevented when the pointer is down. Hovering pointers (e.g. a mouse with no buttons pressed) cannot have their mouse events prevented. And, the mouseover and mouseout events are never prevented (even if the pointer is down)."

Type:
  • boolean
Source:
src/input/MSPointer.js line 97
See:

enabled : boolean

PointerEvent input will only be processed if enabled.

Type:
  • boolean
Default Value:
  • true
Source:
src/input/MSPointer.js line 120

event : MSPointerEvent | PointerEvent | null

The most recent PointerEvent from the browser. Will be null if no event has ever been received. Access this property only inside a Pointer event handler and do not keep references to it.

Type:
  • MSPointerEvent | PointerEvent | null
Source:
src/input/MSPointer.js line 105

game : Phaser.Game

A reference to the currently running game.

Type:
Source:
src/input/MSPointer.js line 45

<protected> input : Phaser.Input

A reference to the Phaser Input Manager.

Type:
Source:
src/input/MSPointer.js line 51

pointerDownCallback : function

A callback that can be fired on a pointerdown (MSPointerDown) event.

Type:
  • function
Source:
src/input/MSPointer.js line 61

pointerMoveCallback : function

A callback that can be fired on a pointermove (MSPointerMove) event.

Type:
  • function
Source:
src/input/MSPointer.js line 66

pointerOutCallback : function

A callback that can be fired on a pointerout (MSPointerOut) event.

Type:
  • function
Source:
src/input/MSPointer.js line 76

pointerOverCallback : function

A callback that can be fired on a pointerover (MSPointerOver) event.

Type:
  • function
Source:
src/input/MSPointer.js line 81

pointerUpCallback : function

A callback that can be fired on a pointerup (MSPointerUp) event.

Type:
  • function
Source:
src/input/MSPointer.js line 71

stopOnGameOut : boolean

If true Pointer.stop() will be called if the pointer leaves the game canvas.

Type:
  • boolean
Source:
src/input/MSPointer.js line 127

Methods

onPointerDown(event)

The function that handles the PointerDown event.

Parameters:
Name Type Description
event PointerEvent

The native DOM event.

Source:
src/input/MSPointer.js line 251

onPointerMove(event)

The function that handles the PointerMove event.

Parameters:
Name Type Description
event PointerEvent

The native DOM event.

Source:
src/input/MSPointer.js line 292

onPointerOut(event)

The internal method that handles the pointer over event from the browser.

Parameters:
Name Type Description
event PointerEvent

The native event from the browser. This gets stored in MSPointer.event.

Source:
src/input/MSPointer.js line 455

onPointerOut(event)

The internal method that handles the pointer out event from the browser.

Parameters:
Name Type Description
event PointerEvent

The native event from the browser. This gets stored in MSPointer.event.

Source:
src/input/MSPointer.js line 397

onPointerUp(event)

The function that handles the PointerUp event.

Parameters:
Name Type Description
event PointerEvent

The native DOM event.

Source:
src/input/MSPointer.js line 330

onPointerUpGlobal(event)

The internal method that handles the mouse up event from the window.

Parameters:
Name Type Description
event PointerEvent

The native event from the browser. This gets stored in MSPointer.event.

Source:
src/input/MSPointer.js line 370

start()

Starts the event listeners running.

Source:
src/input/MSPointer.js line 169

stop()

Stop the event listeners.

Source:
src/input/MSPointer.js line 494

phaser-ce@2.13.2 is on GitHub and NPM

Documentation generated by JSDoc 3.5.4 on 2019-05-22 using Tomorrow.