From a7d5c59207fca7cdcd3f1e675635d04ac7a1d1ca Mon Sep 17 00:00:00 2001 From: JSR Date: Fri, 20 Mar 2026 20:26:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=AB=96=E5=B1=8F=E4=B8=BA?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=B0=BA=E5=AF=B8=E5=B9=B6=E6=94=BE=E5=AE=BD?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E6=9C=80=E5=B0=8F=E5=B0=BA=E5=AF=B8=E9=99=90?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/tauri.conf.json | 4 ++-- src/App.tsx | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 3bade52..44642d9 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -22,8 +22,8 @@ "decorations": false, "transparent": false, "center": true, - "minWidth": 800, - "minHeight": 600 + "minWidth": 360, + "minHeight": 640 } ], "security": { diff --git a/src/App.tsx b/src/App.tsx index 3dada4d..914ffe2 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -284,24 +284,26 @@ function MainContent(): React.JSX.Element { const availableWidth = window.screen?.availWidth || window.innerWidth || 1200 const availableHeight = window.screen?.availHeight || window.innerHeight || 800 return { - maxWidth: Math.max(800, Math.round(availableWidth - 64)), - maxHeight: Math.max(600, Math.round(availableHeight - 64)), + maxWidth: Math.max(360, Math.round(availableWidth - 64)), + maxHeight: Math.max(640, Math.round(availableHeight - 64)), } } const getFixedPortraitSize = () => { const { maxWidth, maxHeight } = getMaxWindowSize() - const width = Math.min(940, maxWidth) - const height = Math.max(600, Math.min(1600, maxHeight)) + const phonePortraitBase = { width: 430, height: 932 } + let width = Math.max(360, Math.min(phonePortraitBase.width, maxWidth)) + let height = Math.max(640, Math.min(phonePortraitBase.height, maxHeight)) - if (height > width) { - return { width, height } + // 保证竖屏高于宽,维持手机风格比例。 + if (height <= width) { + height = Math.min(maxHeight, Math.max(640, Math.round(width * 2.0))) + } + if (height <= width) { + width = Math.max(360, Math.min(maxWidth, Math.round(height * 0.5))) } - return { - width: Math.min(maxWidth, Math.max(800, width - 120)), - height: Math.min(maxHeight, Math.max(600, height + 120)), - } + return { width, height } } const getLandscapeRestoreSize = () => {