mirror of
https://github.com/Eaglercraft-Archive/Eaglercraftx-1.8.8-src.git
synced 2025-07-14 03:19:57 -05:00
Update #53 - Improved FPS, reduced WebGL context loss crashes
This commit is contained in:
@ -118,7 +118,8 @@ async function initPlatformInput(inputImports) {
|
||||
blur: null,
|
||||
pointerlock: null,
|
||||
pointerlockerr: null,
|
||||
fullscreenChange: null
|
||||
fullscreenChange: null,
|
||||
visibilitychange: null
|
||||
};
|
||||
|
||||
touchKeyboardOpenZone = document.createElement("div");
|
||||
@ -351,6 +352,11 @@ async function initPlatformInput(inputImports) {
|
||||
pushEvent(EVENT_TYPE_INPUT, EVENT_INPUT_FOCUS, null);
|
||||
});
|
||||
|
||||
document.addEventListener("visibilitychange", currentEventListeners.visibilitychange = function(/** Event */ evt) {
|
||||
if (handleVisibilityChange)
|
||||
handleVisibilityChange();
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {number} evtType
|
||||
* @param {KeyboardEvent} evt
|
||||
@ -1138,6 +1144,10 @@ async function initPlatformInput(inputImports) {
|
||||
window.removeEventListener("blur", /** @type {function(Event)} */ (currentEventListeners.blur));
|
||||
currentEventListeners.blur = null;
|
||||
}
|
||||
if(currentEventListeners.visibilitychange) {
|
||||
document.removeEventListener("visibilitychange", currentEventListeners.visibilitychange);
|
||||
currentEventListeners.visibilitychange = null;
|
||||
}
|
||||
if(currentEventListeners.pointerlock) {
|
||||
document.removeEventListener("pointerlockchange", /** @type {function(Event)} */ (currentEventListeners.pointerlock));
|
||||
currentEventListeners.pointerlock = null;
|
||||
|
Reference in New Issue
Block a user