From b3997815e1f5335a7bc48253bfc8f545ad0be7e6 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Fri, 27 Feb 2026 22:48:53 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=B1=20=E5=8A=9F=E8=83=BD=E9=A2=84?= =?UTF-8?q?=E7=95=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #223 --- src/utils/TGWindow.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/utils/TGWindow.ts b/src/utils/TGWindow.ts index ad813473..1423f5be 100644 --- a/src/utils/TGWindow.ts +++ b/src/utils/TGWindow.ts @@ -99,6 +99,27 @@ export function getWindowSize(label: string): PhysicalSize { } } +/** + * 判断窗口位置 + * @since Beta v0.9.8 + * @returns 无返回值 + */ +export async function setWindowPos(): Promise { + const screen = await currentMonitor(); + if (screen === null) { + showSnackbar.error("获取屏幕信息失败!", 3000); + return; + } + const windowCur = webviewWindow.getCurrentWebviewWindow(); + const textScale = await invoke("read_text_scale"); + if (await windowCur.isMaximized()) return; + const designSize = getWindowSize(windowCur.label); + console.log(textScale, designSize); + // TODO: 判断设计大小是否会超出窗口大小 + // 如果超出,设计合适窗口位置使得顶部能够展示或者将窗口最大化 + // 否则直接居中 +} + /** * 窗口适配 * @since Beta v0.9.6