Skip to content

设置:主页字体大小改为界面尺寸,整个主窗口一起缩放 - #1509

Open
ilynthn wants to merge 7 commits into
mainfrom
t3/scale-main-window-ui
Open

ilynthn wants to merge 7 commits into
mainfrom
t3/scale-main-window-ui

Conversation

@ilynthn

@ilynthn ilynthn commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

问题

「主页字体大小」只改变部分首页文字,按钮、图标、间距和其他页面仍保持原来的尺寸

旧版保存的非整档倍率会让设置表单校验失败,主窗口缩放后学习页的内嵌网页也会偏离预留区域

改动

  • 将设置改为「界面尺寸」,提供 0.85、1、1.15、1.3 四档,沿用 homeFontScale 保存偏好

  • 主窗口用 WebView2 整页缩放,命令仅接受 main 窗口并将倍率限制在 0.85–1.3。移除首页旧字号倍率的写入,避免重复放大

  • 主窗口以隐藏状态启动,前端读取偏好时先调用缩放,再走 ready 显示窗口。阅读层继续用自己的 WebView2 ZoomFactor 和 DPI 换算指针坐标

  • 评审修复:publicPreferences 读取旧倍率时归到最近一档,保存桥复用同一规则,前端从偏好读取可直接用于数字框的倍率

  • 评审修复:主窗口记录已设倍率,学习页内嵌网页的位置和尺寸使用 DPI × 主窗口倍率换算,内嵌内容同步缩放

验证

  • 在 origin/main(8a2cdd10)运行新增前端断言,两条均按预期失败:没有发出缩放调用,首页旧字号倍率仍为 1.3
  • 在本分支运行 node --test validation/appearance.test.cjs validation/ui-zoom.test.cjs validation/no-ghost-windows.test.cjs validation/window-chrome.test.cjs,13 项通过。覆盖偏好保存与夹紧、倍率变化时只调用一次、首页无重复放大
  • cargo check --locked --manifest-path desktop/Cargo.toml 与加 --tests 的编译检查均通过。Rust 部分仅做编译检查,真机缩放和首屏是否闪动待店主确认
  • 隔离无头 Edge 使用 CSS zoom 模拟 1.0 和 1.3,首页、设置页各一组 1600×900 截图,计算得到的旧字号倍率为 1
  • 四张截图已生成,待通过已登录的 GitHub 浏览器上传到正文

评审修复验证(8a1b6e26)

  • 在修复前的 PR head df3ab022 上,validation/ui-zoom.test.cjs 的保存断言失败(1.1 仍保存成 1.1),无头 Edge 中 1.1 和 0.9 都触发了数字框的 stepMismatch
  • 同一 head 上,desktop/src/main.rs 的 kanji_embed_bounds_include_main_window_zoom 在 1.3 倍时失败,仍返回 600×300,预期为 780×390
  • 修复后,node --test validation/appearance.test.cjs validation/ui-zoom.test.cjs validation/no-ghost-windows.test.cjs validation/window-chrome.test.cjs 通过 14 项,cargo test --locked --manifest-path desktop/Cargo.toml --bin megulit zoom 通过 2 项,cargo check --locked --manifest-path desktop/Cargo.toml 通过
  • 内嵌网页的原生窗口实机显示未验证

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T17:59:10.110985Z 9b04600 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b04600b0e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread web/app.js Resolved
Comment thread desktop/src/main.rs Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 等合并

Development

Successfully merging this pull request may close these issues.

1 participant