From 1dedb65956674ea428612df5f82689a481183aab Mon Sep 17 00:00:00 2001 From: JSR Date: Thu, 19 Mar 2026 20:13:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80iOS=E8=A7=86=E5=8F=A3?= =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E5=B9=B6=E5=85=B3=E9=97=AD=E9=80=8F=E6=98=8E?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E4=BB=A5=E4=BF=AE=E5=A4=8D=E9=BB=91=E8=BE=B9?= =?UTF-8?q?=E4=B8=8E=E7=99=BD=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/tauri.conf.json | 2 +- src/main.tsx | 37 ------------------------------------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index bc9e2ff..2b5900b 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -20,7 +20,7 @@ "resizable": true, "fullscreen": false, "decorations": false, - "transparent": true, + "transparent": false, "center": true, "minWidth": 800, "minHeight": 600 diff --git a/src/main.tsx b/src/main.tsx index 8394a0f..b7d4ac5 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -77,43 +77,6 @@ const patchConsole = () => { } patchConsole() -const syncAppViewportHeight = () => { - const rootStyle = document.documentElement.style - - const readViewportHeight = () => { - const innerHeight = Number.isFinite(window.innerHeight) ? Math.round(window.innerHeight) : 0 - const visualViewport = window.visualViewport - const visualHeight = - visualViewport && Number.isFinite(visualViewport.height) ? Math.round(visualViewport.height) : 0 - - return Math.max(innerHeight, visualHeight) - } - - const applyHeight = () => { - try { - const viewportHeight = readViewportHeight() - // 避免 iOS 首帧偶发 0 高度把根节点压扁导致白屏 - if (viewportHeight < 320) return - rootStyle.setProperty("--ss-app-height", `${viewportHeight}px`) - } catch { - void 0 - } - } - - applyHeight() - window.setTimeout(applyHeight, 50) - window.setTimeout(applyHeight, 300) - window.addEventListener("resize", applyHeight) - window.addEventListener("orientationchange", applyHeight) - const visualViewport = window.visualViewport - if (visualViewport && typeof visualViewport.addEventListener === "function") { - visualViewport.addEventListener("resize", applyHeight) - visualViewport.addEventListener("scroll", applyHeight) - } -} - -syncAppViewportHeight() - const disableTouchZoom = () => { let lastTouchEnd = 0