mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 07:04:31 +00:00
Device.touch checks if window.navigator.maxTouchPoints
is >= 1
rather than > 1, which now allows touch events to work properly in Chrome mobile emulation.
This commit is contained in:
parent
5bd231d532
commit
9cdcdc7bc5
4 changed files with 14 additions and 2 deletions
|
@ -68,6 +68,7 @@ Version 2.3.0 - "Tarabon" - in dev
|
|||
* MSPointer.capture allows you to optionally event.preventDefault the pointer events (was previously always on)
|
||||
* MSPointer.event now stores the most recent pointer event.
|
||||
* MSPointer.pointerDownCallback, pointerMoveCallback and pointerUpCallback all allow you to set your own event based callbacks.
|
||||
* MSPointer.button now records which button was pressed down (if any)
|
||||
|
||||
### Updates
|
||||
|
||||
|
@ -83,6 +84,7 @@ Version 2.3.0 - "Tarabon" - in dev
|
|||
* TilemapLayer.getTiles now returns a copy of the Tiles found by the method, rather than references to the original Tile objects, so you're free to modify them without corrupting the source (thanks @Leekao #1585)
|
||||
* Sprite.events.onDragStart has 2 new parameters `x` and `y` which is the position of the Sprite before the drag was started. The full list of parameters is: `(sprite, pointer, x, y)`. This allows you to retain the position of the Sprite prior to dragging should `dragFromCenter` have been enabled (thanks @vulvulune #1583)
|
||||
* Body.reset now resets the Body.speed value to zero.
|
||||
* Device.touch checks if `window.navigator.maxTouchPoints` is `>= 1` rather than > 1, which now allows touch events to work properly in Chrome mobile emulation.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
|
|
@ -46,6 +46,12 @@ Phaser.MSPointer = function (game) {
|
|||
*/
|
||||
this.capture = false;
|
||||
|
||||
/**
|
||||
* @property {number} button- The type of click, either: Phaser.Mouse.NO_BUTTON, Phaser.Mouse.LEFT_BUTTON, Phaser.Mouse.MIDDLE_BUTTON or Phaser.Mouse.RIGHT_BUTTON.
|
||||
* @default
|
||||
*/
|
||||
this.button = -1;
|
||||
|
||||
/**
|
||||
* The browser MSPointer DOM event. 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.
|
||||
|
@ -141,6 +147,8 @@ Phaser.MSPointer.prototype = {
|
|||
event.preventDefault();
|
||||
}
|
||||
|
||||
this.button = event.button;
|
||||
|
||||
if (this.pointerDownCallback)
|
||||
{
|
||||
this.pointerDownCallback.call(this.callbackContext, event);
|
||||
|
@ -201,6 +209,8 @@ Phaser.MSPointer.prototype = {
|
|||
event.preventDefault();
|
||||
}
|
||||
|
||||
this.button = Phaser.Mouse.NO_BUTTON;
|
||||
|
||||
if (this.pointerUpCallback)
|
||||
{
|
||||
this.pointerUpCallback.call(this.callbackContext, event);
|
||||
|
|
|
@ -249,6 +249,7 @@ Phaser.Mouse.prototype = {
|
|||
}
|
||||
|
||||
var wheelEvent = this.game.device.wheelEvent;
|
||||
|
||||
if (wheelEvent)
|
||||
{
|
||||
this.game.canvas.addEventListener(wheelEvent, this._onMouseWheel, true);
|
||||
|
|
|
@ -686,8 +686,7 @@ Phaser.Device._initialize = function () {
|
|||
*/
|
||||
function _checkInput () {
|
||||
|
||||
if ('ontouchstart' in document.documentElement ||
|
||||
(window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 1))
|
||||
if ('ontouchstart' in document.documentElement || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints >= 1))
|
||||
{
|
||||
device.touch = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue