Skip to content

Commit

Permalink
Show debug information while waiting for fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
roginvs committed Nov 19, 2024
1 parent dab8e19 commit 0b2309e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion os/web/index.sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const CACHE_FILES = [
"/",
];

const VERSION = 129;
const VERSION = 130;

const ENGINE_CACHE_NAME = "engine";

Expand Down
21 changes: 14 additions & 7 deletions os/web/mainmenu.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -647,18 +647,25 @@ function renderGameMenu(game, menuDiv, lang, hideWhenNoSaveGames) {

const start = new Date();
const MAX_DELAY_MS =
window.location.hostname === "localhost" ? 1000 : 5000;
window.location.hostname === "localhost" ? 1000 : 3000;
setStatusText("Waiting for fullscreen...");
while (new Date().getTime() - start.getTime() < MAX_DELAY_MS) {
if (
const cssPixelDiff =
Math.abs(screen.width - canvasParent.clientWidth) +
Math.abs(
screen.height - canvasParent.clientHeight
) <
1
) {
Math.abs(screen.height - canvasParent.clientHeight);

if (cssPixelDiff < 1) {
break;
}
setStatusText(
`Waiting for fullscreen d=${cssPixelDiff} ` +
`screen=${screen.width}x${screen.height} ` +
`client=${canvasParent.clientWidth}x${canvasParent.clientHeight} ` +
`t=${
MAX_DELAY_MS -
(new Date().getTime() - start.getTime())
}ms`
);
await new Promise((r) => setTimeout(r, 10));
}
setStatusText(null);
Expand Down

0 comments on commit 0b2309e

Please sign in to comment.