From e44d1b67b9b5a0cae386bb760ab4220c4465dc1f Mon Sep 17 00:00:00 2001 From: JSR Date: Thu, 19 Mar 2026 20:03:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20iOS=20=E5=BA=95=E9=83=A8?= =?UTF-8?q?=E9=BB=91=E8=BE=B9=EF=BC=8C=E6=94=B9=E4=B8=BA=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E8=A7=86=E5=8F=A3=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main.tsx b/src/main.tsx index b7d4ac5..6682dd6 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -77,6 +77,23 @@ const patchConsole = () => { } patchConsole() +const syncAppViewportHeight = () => { + const rootStyle = document.documentElement.style + + const applyHeight = () => { + const viewportHeight = window.visualViewport?.height ?? window.innerHeight + rootStyle.setProperty("--ss-app-height", `${Math.round(viewportHeight)}px`) + } + + applyHeight() + window.addEventListener("resize", applyHeight) + window.addEventListener("orientationchange", applyHeight) + window.visualViewport?.addEventListener("resize", applyHeight) + window.visualViewport?.addEventListener("scroll", applyHeight) +} + +syncAppViewportHeight() + const disableTouchZoom = () => { let lastTouchEnd = 0