PIXI Controls: Disable idle animation on locked device

This commit is contained in:
OleSTEEP 2024-03-08 22:40:52 +03:00
parent facea0d1cc
commit 61084be940
2 changed files with 32 additions and 0 deletions

View file

@ -460,6 +460,21 @@ ONSControls.gamepadHandler = function() {
window.addEventListener("gamepadconnected", () => {this.toggle(false);});
window.addEventListener("gamepaddisconnected", () => {this.toggle(true);});
}
//=============================================================================
// * Disable idle animation on locked device
//=============================================================================
ONSControls.cordovaHandler = function() {
document.addEventListener("pause", () => {
console.log("Idle stopped");
ONSControls.idleDisabled = true;
ONSControls.resetIdleAnimation();
});
document.addEventListener("resume", () => {
console.log("Idle started");
ONSControls.idleDisabled = false;
ONSControls.resetIdleAnimation();
});
}
@ -1084,4 +1099,5 @@ ONSControls.initialize = function() {
VirtualGamepad.initialize();
Window_OmoMenuOptionsONSControls.prototype.add();
this.gamepadHandler();
this.cordovaHandler();
}