From ebea211aebd408a28366bf1a6f9edc3e3f6be448 Mon Sep 17 00:00:00 2001 From: krmbn0576 Date: Thu, 30 Aug 2018 01:46:53 +0900 Subject: [PATCH] Fix touches were not refreshed when the game window lost focus --- js/rpg_core/TouchInput.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/rpg_core/TouchInput.js b/js/rpg_core/TouchInput.js index 25713367..e4c42033 100644 --- a/js/rpg_core/TouchInput.js +++ b/js/rpg_core/TouchInput.js @@ -256,6 +256,7 @@ TouchInput._setupEventHandlers = function() { document.addEventListener('touchend', this._onTouchEnd.bind(this)); document.addEventListener('touchcancel', this._onTouchCancel.bind(this)); document.addEventListener('pointerdown', this._onPointerDown.bind(this)); + window.addEventListener('blur', this._onLostFocus.bind(this)); }; /** @@ -440,6 +441,15 @@ TouchInput._onPointerDown = function(event) { } }; +/** + * @static + * @method _onLostFocus + * @private + */ +TouchInput._onLostFocus = function() { + this.clear(); +}; + /** * @static * @method _onTrigger