|
|
@@ -478,6 +478,11 @@
|
|
|
this.graph.on('node:mouseleave', handleLeave);
|
|
|
this.graph.on('edge:mouseenter', handleEdgeEnter);
|
|
|
this.graph.on('edge:mouseleave', handleLeave);
|
|
|
+
|
|
|
+ // 监听布局变化,重新绘制关联线
|
|
|
+ this.graph.on('afterlayout', () => {
|
|
|
+ this.drawRelationEdges();
|
|
|
+ });
|
|
|
// 全量刷新,避免缩放重影
|
|
|
const canvas = this.graph && typeof this.graph.get === 'function' ? this.graph.get('canvas') : null;
|
|
|
if (canvas && typeof canvas.set === 'function') {
|
|
|
@@ -566,10 +571,13 @@
|
|
|
this.relationEdges.forEach((edge, index) => {
|
|
|
// 检查节点是否存在
|
|
|
if (!this.graph.findById(edge.source) || !this.graph.findById(edge.target)) {
|
|
|
- // console.warn(`Edge skipped: ${edge.source} -> ${edge.target} (node missing)`);
|
|
|
return;
|
|
|
}
|
|
|
const model = buildModel(edge, index);
|
|
|
+ // 防止重复添加
|
|
|
+ if (this.graph.findById(model.id)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (canAddEdge) {
|
|
|
this.graph.addEdge(model);
|
|
|
} else {
|