Ocultar botón de pantalla completa si no es posible
This commit is contained in:
parent
fbcb0f59e9
commit
d2105b0ea4
1 changed files with 12 additions and 7 deletions
19
src/main.ts
19
src/main.ts
|
@ -295,12 +295,17 @@ async function initJuego() {
|
|||
window.requestAnimationFrame(loop);
|
||||
}
|
||||
|
||||
document.getElementById("full-screen")!.addEventListener("click", async () => {
|
||||
document.documentElement.requestFullscreen &&
|
||||
(await document.documentElement.requestFullscreen({
|
||||
navigationUI: "hide",
|
||||
}));
|
||||
await screen.orientation.lock("landscape");
|
||||
});
|
||||
const fullscreenEl = document.getElementById("full-screen")!;
|
||||
if ("requestFullscreen" in document.documentElement) {
|
||||
fullscreenEl.addEventListener("click", async () => {
|
||||
document.documentElement.requestFullscreen &&
|
||||
(await document.documentElement.requestFullscreen({
|
||||
navigationUI: "hide",
|
||||
}));
|
||||
await screen.orientation.lock("landscape");
|
||||
});
|
||||
} else {
|
||||
fullscreenEl.hidden = true;
|
||||
}
|
||||
|
||||
initJuego();
|
||||
|
|
Loading…
Reference in a new issue