From 8c0fd575766a315ef855278588022c55a9ff64c6 Mon Sep 17 00:00:00 2001 From: skejeton Date: Mon, 2 Sep 2024 07:08:09 -0300 Subject: [PATCH] Fix html page focus --- etc/shell.html | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/etc/shell.html b/etc/shell.html index 5960d193..0e0c54b8 100644 --- a/etc/shell.html +++ b/etc/shell.html @@ -31,6 +31,7 @@ var statusElement = document.getElementById('status'); var progressElement = document.getElementById('progress'); var spinnerElement = document.getElementById('spinner'); + var canvas = document.getElementById('canvas'); var Module = { postRun: [], @@ -59,14 +60,33 @@ } }; window.addEventListener("resize", (e) => { - var canvas = document.getElementById('canvas') window.focus(); canvas.focus(); canvas.width = window.innerWidth; canvas.height = window.innerHeight; }) + window.addEventListener("mousedown", (e) => { + e.preventDefault() + window.focus(); + canvas.focus(); + }) + canvas.addEventListener("wheel", (e) => { + e.preventDefault(); + }) + canvas.addEventListener("mousewheel", (e) => { + e.preventDefault(); + }) + window.addEventListener("mouseup", (e) => { + e.preventDefault() + window.focus(); + canvas.focus(); + }) + window.addEventListener("scroll", (e) => { + e.preventDefault() + window.focus(); + canvas.focus(); + }) window.addEventListener("click", (e) => { - var canvas = document.getElementById('canvas') window.focus(); canvas.focus(); })