fix(Log): Graph 后文字自适应贴近以消除留白#35
Merged
Merged
Conversation
原实现每行 Graph SVG 宽度取全局 maxLanes(基于已加载全部提交),分支型仓库中仅用 1-2 条 lane 的行仍预留整宽,导致节点与文字间大片留白。改为按「本行实际绘制的最右列」计算行宽,文字随即向左贴近本行 Graph(lane x 坐标仍全局一致,竖线跨行衔接不变)。 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
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.
背景
#34 将 Log 视图升级为 IDEA 风格提交图(Graph DAG)并已合入
feature/1.x.x。用户实测反馈(截图红框标注):Graph 节点与后面的提交文字之间存在大片留白,文字离 Graph 太远,不符合 IDEA「文字紧随 Graph」的观感。根因
log-webview.ts渲染时,每行 Graph SVG 的宽度取自「已加载全部提交(1000 条)」的全局maxLanes:分支型仓库中,
maxLanes被历史中某处的宽分叉(多 feature 并存)撑大(如 6–8 条 lane),而绝大多数行只占用 1–2 条 lane。这些行仍预留整宽,于是节点(位于 col 0)与文字(位于 graphPx)之间出现大片空白。修复
按本行实际绘制的最右列自适应计算行宽,文字随即向左贴近本行 Graph:
colX(c) = c*LANE_W + LANE_W/2),故竖线跨行衔接、分支拓扑完全不变;验证
pnpm run compile(tsc + eslint + esbuild)全绿pnpm test:unit218/218 通过(engine 未改,仅 webview 内联 JS 行宽计算)src/adapter/webview/log-webview.ts(+3/-2,内联 JS)+CHANGELOG.md🤖 Generated with Claude Code, CodeX, Gemini
Co-Authored-By: Aurelius Huangthreefish.ai@gmail.com