From 254bec0a48fc3c89a4f715ced889d1ac423ec515 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Fri, 2 Sep 2022 15:13:25 +0300 Subject: [PATCH] stop using visualviewport, because it made things worse --- frontend/src/responsive.js | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/frontend/src/responsive.js b/frontend/src/responsive.js index 7c72ae2..3fdd2f4 100644 --- a/frontend/src/responsive.js +++ b/frontend/src/responsive.js @@ -9,21 +9,12 @@ function initViewportSizeHandler() { root.style.setProperty("--viewportWidth", "100dvw"); root.style.setProperty("--viewportHeight", "100dvh"); } else if (method === "javascriptResponsive") { - if (window.visualViewport) { - const updateUnits = () => { - root.style.setProperty("--viewportWidth", `${window.visualViewport.width}px`); - root.style.setProperty("--viewportHeight", `${window.visualViewport.height}px`); - }; - window.visualViewport.addEventListener("resize", updateUnits); - updateUnits(); - } else { - const updateUnits = () => { - root.style.setProperty("--viewportWidth", `${window.innerWidth}px`); - root.style.setProperty("--viewportHeight", `${window.innerHeight}px`); - }; - window.addEventListener("resize", updateUnits); - updateUnits(); - } + const updateUnits = () => { + root.style.setProperty("--viewportWidth", `${window.innerWidth}px`); + root.style.setProperty("--viewportHeight", `${window.innerHeight}px`); + }; + window.addEventListener("resize", updateUnits); + updateUnits(); } else if (method === "normalUnits") { root.style.setProperty("--viewportWidth", "100vw"); root.style.setProperty("--viewportHeight", "100vh");