Ocultar botón de pantalla completa si no es posible

This commit is contained in:
Nulo 2021-07-06 22:13:18 +00:00
parent fbcb0f59e9
commit d2105b0ea4

View file

@ -295,12 +295,17 @@ async function initJuego() {
window.requestAnimationFrame(loop); window.requestAnimationFrame(loop);
} }
document.getElementById("full-screen")!.addEventListener("click", async () => { const fullscreenEl = document.getElementById("full-screen")!;
document.documentElement.requestFullscreen && if ("requestFullscreen" in document.documentElement) {
(await document.documentElement.requestFullscreen({ fullscreenEl.addEventListener("click", async () => {
navigationUI: "hide", document.documentElement.requestFullscreen &&
})); (await document.documentElement.requestFullscreen({
await screen.orientation.lock("landscape"); navigationUI: "hide",
}); }));
await screen.orientation.lock("landscape");
});
} else {
fullscreenEl.hidden = true;
}
initJuego(); initJuego();