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:

new Phaser.Game({ mspointer: false });
Parameters:
Name Type Description
game Phaser.Game

A reference to the currently running game.

Source:
src/input/MSPointer.js line 27

Members

<readonly> active : boolean

Whether the input handler is active.

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

callbackContext : object

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

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

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 89
See:

enabled : boolean

PointerEvent input will only be processed if enabled.

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

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 97

game : Phaser.Game

A reference to the currently running game.

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

<protected> input : Phaser.Input

A reference to the Phaser Input Manager.

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

pointerCancelCallback : function

A callback that can be fired on a pointercancel event.

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

pointerDownCallback : function

A callback that can be fired on a pointerdown event.

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

pointerMoveCallback : function

A callback that can be fired on a pointermove event.

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

pointerOutCallback : function

A callback that can be fired on a pointerout event.

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

pointerOverCallback : function

A callback that can be fired on a pointerover event.

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

pointerUpCallback : function

A callback that can be fired on a pointerup event.

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

stopOnGameOut : boolean

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

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

Methods

onPointerCancel(event)

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

Parameters:
Name Type Description
event PointerEvent
Source:
src/input/MSPointer.js line 464

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 247

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 286

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 385

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 434

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 322

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 360

start()

Starts the event listeners running.

Source:
src/input/MSPointer.js line 160

stop()

Stop the event listeners.

Source:
src/input/MSPointer.js line 496

phaser-ce@2.20.1 is on GitHub and NPM

Documentation generated by JSDoc 3.6.11 on 2024-10-05 using Tomorrow.