Skip to content

Commit befbc78

Browse files
committed
Added new TouchCancelWindow handler
1 parent 15654be commit befbc78

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/input/touch/TouchManager.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,16 @@ var TouchManager = new Class({
133133
*/
134134
this.onTouchCancel = NOOP;
135135

136+
/**
137+
* The Touch Cancel event handler function specifically for events on the Window.
138+
* Initially empty and bound in the `startListeners` method.
139+
*
140+
* @name Phaser.Input.Touch.TouchManager#onTouchCancelWindow
141+
* @type {function}
142+
* @since 3.18.0
143+
*/
144+
this.onTouchCancelWindow = NOOP;
145+
136146
/**
137147
* The Touch Over event handler function.
138148
* Initially empty and bound in the `startListeners` method.
@@ -273,6 +283,14 @@ var TouchManager = new Class({
273283
}
274284
};
275285

286+
this.onTouchCancelWindow = function (event)
287+
{
288+
if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled)
289+
{
290+
_this.manager.onTouchCancel(event);
291+
}
292+
};
293+
276294
this.onTouchOver = function (event)
277295
{
278296
if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled)
@@ -310,6 +328,7 @@ var TouchManager = new Class({
310328
{
311329
window.addEventListener('touchstart', this.onTouchStartWindow, nonPassive);
312330
window.addEventListener('touchend', this.onTouchEndWindow, nonPassive);
331+
window.addEventListener('touchcancel', this.onTouchCancelWindow, nonPassive);
313332
}
314333

315334
this.enabled = true;

0 commit comments

Comments
 (0)