fix(canvas): 节点间连线去重并放大弯折点

This commit is contained in:
2026-10-12 13:59:11 +08:00
parent 256eeb3234
commit ec5dd9adf7
3 changed files with 7 additions and 2 deletions
+2 -1
View File
@@ -378,7 +378,8 @@ function deleteSelection() {
// ---- 手动连线 ----
function onLinkCreate({ from, to, fromSide, toSide }) {
if (doc.edges.some((e) => e.from === from && e.to === to)) return // 去重
// 任意方向去重:两个节点之间只允许一条连线
if (doc.edges.some((e) => (e.from === from && e.to === to) || (e.from === to && e.to === from))) return
doc.edges.push({ id: newId('e'), from, to, fromSide, toSide })
pushHistory()
}