Skip to content

Commit 7daa8b9

Browse files
committed
Added touchcancel handler and wasCancelled property
1 parent f29126c commit 7daa8b9

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

src/input/Pointer.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,16 @@ var Pointer = new Class({
284284
*/
285285
this.wasTouch = false;
286286

287+
/**
288+
* Did this Pointer get cancelled by a touchcancel event?
289+
*
290+
* @name Phaser.Input.Pointer#wasCancelled
291+
* @type {boolean}
292+
* @default false
293+
* @since 3.15.0
294+
*/
295+
this.wasCancelled = false;
296+
287297
/**
288298
* If the mouse is locked, the horizontal relative movement of the Pointer in pixels since last frame.
289299
*
@@ -524,6 +534,7 @@ var Pointer = new Class({
524534
this.dirty = true;
525535

526536
this.wasTouch = true;
537+
this.wasCancelled = false;
527538
},
528539

529540
/**
@@ -580,6 +591,35 @@ var Pointer = new Class({
580591
this.dirty = true;
581592

582593
this.wasTouch = true;
594+
this.wasCancelled = false;
595+
596+
this.active = false;
597+
},
598+
599+
/**
600+
* Internal method to handle a Touch Cancel Event.
601+
*
602+
* @method Phaser.Input.Pointer#touchcancel
603+
* @private
604+
* @since 3.15.0
605+
*
606+
* @param {TouchEvent} event - The Touch Event to process.
607+
*/
608+
touchcancel: function (event)
609+
{
610+
this.buttons = 0;
611+
612+
this.event = event;
613+
614+
this.primaryDown = false;
615+
616+
this.justUp = false;
617+
this.isDown = false;
618+
619+
this.dirty = true;
620+
621+
this.wasTouch = true;
622+
this.wasCancelled = true;
583623

584624
this.active = false;
585625
},

0 commit comments

Comments
 (0)