Repository navigation
fix(layout): exclude Dagre endpoints from control points - #7687
Conversation
|
@dvd233 是不是应该在 layout 库修复这个问题? |
|
我倾向于先在 G6 的适配层处理:Dagre 的 edge.points 表示包含节点边界端点的完整折线,而 G6 的 controlPoints 只应包含中间点,渲染时会自行补端点。直接传入会重复端点,导致末端切线为零;这不一定是 layout 的完整折线输出有误。这个补丁仅在 Dagre → G6 controlPoints 的转换中取 slice(1, -1),不修改原始 layout 结果,也不改变 AntVDagre/custom layout 的行为,避免影响其他直接消费完整 points 的调用方。四个方向的回归均已验证先失败后通过,浏览器里 12 条边的末端切线和箭头方向也已核对。这里的选择基于上述两层数据契约,最终修复位置请维护者确认。 |
There was a problem hiding this comment.
🟢 Approval recommended
The narrow fix matches endpoint rendering behavior, has focused regression coverage, and has no unresolved findings.
0 open findings
What changed in this PR
Fixes Dagre edge arrow orientation by excluding node-boundary endpoints from rendered control points, addressing #7671.
Changes:
- Removes endpoints only for Dagre, preserving other layouts and raw layout data.
- Adds regressions for all four rank directions, missing/empty points, and input immutability.
| File | Description |
|---|---|
| packages/g6/src/utils/layout.ts | Excludes Dagre endpoints from control points. |
| packages/g6/__tests__/unit/utils/layout.spec.ts | Adds regression and compatibility coverage. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v5 #7687 +/- ##
=======================================
Coverage 94.43% 94.43%
=======================================
Files 188 188
Lines 10099 10101 +2
Branches 2152 2153 +1
=======================================
+ Hits 9537 9539 +2
Misses 516 516
Partials 46 46
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Fixes #7671.
Dagre includes node-boundary endpoints in
edge.points. Passing these through as control points duplicates the rendered endpoints, leaving a zero-length end tangent and incorrect arrow orientation.Exclude those endpoints only for Dagre, preserving AntVDagre/custom-layout output and the raw layout data. Add regressions for all four rank directions, missing/empty points, and input immutability.
Validation:
it.onlyincamera-setting.spec.ts(Ubuntu, Node 22, native SWC). Changed statements and branches are fully covered.drag-nodewarning remains; this probe covers the initial static layout.