Skip to content

Commit 24d17c7

Browse files
authored
Merge pull request rpgtkoolmv#184 from rpgtkoolmv/touch_lostfocus
Fix touches were not refreshed when the game window lost focus
2 parents 587a7fb + ebea211 commit 24d17c7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

js/rpg_core/TouchInput.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ TouchInput._setupEventHandlers = function() {
256256
document.addEventListener('touchend', this._onTouchEnd.bind(this));
257257
document.addEventListener('touchcancel', this._onTouchCancel.bind(this));
258258
document.addEventListener('pointerdown', this._onPointerDown.bind(this));
259+
window.addEventListener('blur', this._onLostFocus.bind(this));
259260
};
260261

261262
/**
@@ -440,6 +441,15 @@ TouchInput._onPointerDown = function(event) {
440441
}
441442
};
442443

444+
/**
445+
* @static
446+
* @method _onLostFocus
447+
* @private
448+
*/
449+
TouchInput._onLostFocus = function() {
450+
this.clear();
451+
};
452+
443453
/**
444454
* @static
445455
* @method _onTrigger

0 commit comments

Comments
 (0)