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 80
-
callbackContext : object
-
The context under which callbacks are called (defaults to game).
Type:
- object
- Source:
- src/input/MSPointer.js line 52
-
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 72
-
enabled : boolean
-
PointerEvent input will only be processed if enabled.
Type:
- boolean
- Default Value:
-
- true
- Source:
- src/input/MSPointer.js line 95
-
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 88
-
game : Phaser.Game
-
A reference to the currently running game.
Type:
- Source:
- src/input/MSPointer.js line 41
-
<protected> input : Phaser.Input
-
A reference to the Phaser Input Manager.
Type:
- Source:
- src/input/MSPointer.js line 47
-
pointerDownCallback : function
-
A callback that can be fired on a MSPointerDown event.
Type:
- function
- Source:
- src/input/MSPointer.js line 57
-
pointerMoveCallback : function
-
A callback that can be fired on a MSPointerMove event.
Type:
- function
- Source:
- src/input/MSPointer.js line 62
-
pointerUpCallback : function
-
A callback that can be fired on a MSPointerUp event.
Type:
- function
- Source:
- src/input/MSPointer.js line 67
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 206
-
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 246
-
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 401
-
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 346
-
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 283
-
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 322
-
start()
-
Starts the event listeners running.
- Source:
- src/input/MSPointer.js line 137
-
stop()
-
Stop the event listeners.
- Source:
- src/input/MSPointer.js line 437