Verrouille chrono et cube au viewport mobile
This commit is contained in:
16
app.js
16
app.js
@@ -37,6 +37,17 @@ const MODES = {
|
||||
},
|
||||
};
|
||||
|
||||
syncViewportHeight();
|
||||
window.addEventListener("resize", syncViewportHeight);
|
||||
window.addEventListener("pageshow", syncViewportHeight);
|
||||
window.addEventListener("orientationchange", syncViewportHeight);
|
||||
window.visualViewport?.addEventListener("resize", syncViewportHeight);
|
||||
window.visualViewport?.addEventListener("scroll", syncViewportHeight);
|
||||
window.setTimeout(syncViewportHeight, 0);
|
||||
window.requestAnimationFrame(() => {
|
||||
window.requestAnimationFrame(syncViewportHeight);
|
||||
});
|
||||
|
||||
let match = readStoredMatch();
|
||||
let dirty = false;
|
||||
|
||||
@@ -79,6 +90,11 @@ switch (PAGE) {
|
||||
break;
|
||||
}
|
||||
|
||||
function syncViewportHeight() {
|
||||
const viewportHeight = window.visualViewport?.height ?? window.innerHeight;
|
||||
document.documentElement.style.setProperty("--app-viewport-height", `${Math.round(viewportHeight)}px`);
|
||||
}
|
||||
|
||||
function initSetupPage() {
|
||||
const form = document.querySelector("#setupForm");
|
||||
const summary = document.querySelector("#setupSummary");
|
||||
|
||||
Reference in New Issue
Block a user