Class: MSPointer

Phaser. MSPointer

new MSPointer(game)

The MSPointer class handles Pointer-event interactions with the game via a dedicated Phaser.Pointer. (It's named after the nonstandard MSPointerEvent since that was the first browser implementation.)

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.

Please note that at the current time of writing Phaser does not yet support chorded button interactions: http://www.w3.org/TR/pointerevents/#chorded-button-interactions

You can disable Phaser's use of Pointer Events by either of two ways:

// **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 36

Members

button : number

This property was removed in Phaser 2.4 and should no longer be used. Instead please see the Pointer button properties such as Pointer.leftButton, Pointer.rightButton and so on. Or Pointer.button holds the DOM event button value if you require that.

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

callbackContext : object

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

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

capture : boolean

If true the Pointer events will have event.preventDefault applied to them, canceling the corresponding MouseEvent or TouchEvent.

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

enabled : boolean

PointerEvent input will only be processed if enabled.

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

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 89

game : Phaser.Game

A reference to the currently running game.

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

<protected> input : Phaser.Input

A reference to the Phaser Input Manager.

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

pointerDownCallback : function

A callback that can be fired on a MSPointerDown event.

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

pointerMoveCallback : function

A callback that can be fired on a MSPointerMove event.

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

pointerUpCallback : function

A callback that can be fired on a MSPointerUp event.

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

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 214

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 255

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 358

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 414

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 293

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 333

start()

Starts the event listeners running.

Source:
src/input/MSPointer.js line 138

stop()

Stop the event listeners.

Source:
src/input/MSPointer.js line 451

phaser-ce@2.10.6 is on GitHub and NPM

Documentation generated by JSDoc 3.5.4 on 2018-06-01 using Tomorrow.