Fixed error for window.lastKey

This commit is contained in:
FlamedDogo99 2024-06-06 21:29:11 -06:00
parent 4c5f3ada39
commit e382e2c00c

View File

@ -391,9 +391,11 @@ function insertCanvasElements() {
if(!(e.key && e.keyCode && e.which) && !window.keyboardFix) { if(!(e.key && e.keyCode && e.which) && !window.keyboardFix) {
console.warn("Switching from keydown to input events due to invalid KeyboardEvent. Some functionality will be lost.") console.warn("Switching from keydown to input events due to invalid KeyboardEvent. Some functionality will be lost.")
window.keyboardFix = true; window.keyboardFix = true;
if(window.lastKey) {
keyEvent(window.lastKey, "keydown") keyEvent(window.lastKey, "keydown")
keyEvent(window.lastKey, "keyup") keyEvent(window.lastKey, "keyup")
} }
}
}, false); }, false);
document.body.appendChild(hiddenInput); document.body.appendChild(hiddenInput);
let keyboardButton = createTouchButton("keyboardButton", "inMenu"); let keyboardButton = createTouchButton("keyboardButton", "inMenu");