fix: pin edge endpoints to node edge midpoints for clean orthogonal routing
This commit is contained in:
@@ -155,13 +155,26 @@ function buildFlow(root: PlayerTreeNode) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const nodeMap = new Map(resultNodes.map((n) => [n.id, n]))
|
||||||
|
|
||||||
const resultEdges: FlowEdge[] = dagreEdges.map((e) => {
|
const resultEdges: FlowEdge[] = dagreEdges.map((e) => {
|
||||||
const edge = g.edge(e.from, e.to)
|
const edge = g.edge(e.from, e.to)
|
||||||
|
const pts = edge.points || []
|
||||||
|
if (pts.length >= 2) {
|
||||||
|
const src = nodeMap.get(e.from)
|
||||||
|
const dst = nodeMap.get(e.to)
|
||||||
|
if (src) {
|
||||||
|
pts[0] = { x: src.x + src.w, y: src.y + src.h / 2 }
|
||||||
|
}
|
||||||
|
if (dst) {
|
||||||
|
pts[pts.length - 1] = { x: dst.x, y: dst.y + dst.h / 2 }
|
||||||
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
from: e.from,
|
from: e.from,
|
||||||
to: e.to,
|
to: e.to,
|
||||||
visited: e.visited,
|
visited: e.visited,
|
||||||
points: edge.points || [],
|
points: pts,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user