feat(browser): 网页宽度自动适配与 50% 缩放下限【已审核 PR】 - #1932
Open
Andreaseszhang wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
为 Proma 内置受管浏览器增加固定宽度网页的自动适配能力。浏览器面板变窄时自动降低网页 zoom,变宽时按实际页面宽度逐级恢复,最低支持 50%,并避免测量过程中先闪回 100% 导致的视觉闪烁。
改动
apps/electron/src/main/lib/browser-auto-zoom.ts— 新增页面宽度测量语义、100% 至 50% 的分级 zoom、固定宽 body 处理、固有宽度缓存和有限逐级探测。apps/electron/src/main/lib/browser-auto-zoom.test.ts— 覆盖 layout viewport 选择、固定宽 body、50% 回升、所有缩放档位、非法输入和探测上限。apps/electron/src/main/lib/browser-controller.ts— 接入 WebContentsView 的自动适配、owner zoom 坐标换算、导航代际失效、主进程防抖、动态复测和收敛保护。测试方法
bun test ./apps/electron/src/main/lib/browser-auto-zoom.test.tsgit diff --check origin/main...HEAD备注
node_modules,因此未在该 worktree 运行完整 typecheck;纯算法单测与 diff 检查已通过。Made with Proma · GitHub