From 1f3589f62e9f376b40222a1a63ea755eca14a69a Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Sat, 23 Mar 2024 15:21:28 +0300 Subject: [PATCH] PIXI Controls: Hide controls on keyboard event --- www.eng/js/plugins/VND_ONSControls.js | 7 +++++++ www.rus/js/plugins/VND_ONSControls.js | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/www.eng/js/plugins/VND_ONSControls.js b/www.eng/js/plugins/VND_ONSControls.js index 3278e43..50eda6b 100644 --- a/www.eng/js/plugins/VND_ONSControls.js +++ b/www.eng/js/plugins/VND_ONSControls.js @@ -507,6 +507,12 @@ ONSControls.gamepadHandler = function() { window.addEventListener("gamepaddisconnected", () => {this.toggle(true);}); } //============================================================================= +// * Handle connected physical keyboard and hide ONSControls on keypress +//============================================================================= +ONSControls.keyboardHandler = function() { + document.addEventListener('keydown', () => {this.toggle(false);}); +} +//============================================================================= // * Disable idle animation on locked device //============================================================================= ONSControls.cordovaHandler = function() { @@ -1145,5 +1151,6 @@ ONSControls.initialize = function() { VirtualGamepad.initialize(); Window_OmoMenuOptionsONSControls.prototype.add(); this.gamepadHandler(); + this.keyboardHandler(); this.cordovaHandler(); } \ No newline at end of file diff --git a/www.rus/js/plugins/VND_ONSControls.js b/www.rus/js/plugins/VND_ONSControls.js index 9f24e21..1a79898 100644 --- a/www.rus/js/plugins/VND_ONSControls.js +++ b/www.rus/js/plugins/VND_ONSControls.js @@ -507,6 +507,12 @@ ONSControls.gamepadHandler = function() { window.addEventListener("gamepaddisconnected", () => {this.toggle(true);}); } //============================================================================= +// * Handle connected physical keyboard and hide ONSControls on keypress +//============================================================================= +ONSControls.keyboardHandler = function() { + document.addEventListener('keydown', () => {this.toggle(false);}); +} +//============================================================================= // * Disable idle animation on locked device //============================================================================= ONSControls.cordovaHandler = function() { @@ -1145,5 +1151,6 @@ ONSControls.initialize = function() { VirtualGamepad.initialize(); Window_OmoMenuOptionsONSControls.prototype.add(); this.gamepadHandler(); + this.keyboardHandler(); this.cordovaHandler(); } \ No newline at end of file