修复不同group的结点不能连接的bug
This commit is contained in:
@@ -434,7 +434,7 @@ export class ModelConstructor {
|
||||
sourceNodeType = info.pop();
|
||||
targetGroupName = info.pop();
|
||||
} else {
|
||||
let field = info.pop();
|
||||
let field = info.pop();
|
||||
if (layoutGroupTable.get(targetGroupName).node.find(item => item.sourceType === field)) {
|
||||
sourceNodeType = field;
|
||||
} else if (layoutGroupTable.has(field)) {
|
||||
@@ -444,14 +444,25 @@ export class ModelConstructor {
|
||||
}
|
||||
}
|
||||
|
||||
nodeList = layoutGroupTable.get(targetGroupName).node.filter(item => item.sourceType === sourceNodeType);
|
||||
// 为了可以连接到不同group的结点
|
||||
for (let layoutGroup of layoutGroupTable.values()) {
|
||||
nodeList = layoutGroup.node.filter(item => item.sourceType === sourceNodeType);
|
||||
if (nodeList === undefined) {
|
||||
continue;
|
||||
}
|
||||
targetNode = nodeList.find(item => item.sourceId === targetId);
|
||||
if (targetNode) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// nodeList = layoutGroupTable.get(targetGroupName).node.filter(item => item.sourceType === sourceNodeType);
|
||||
|
||||
// 若目标node不存在,返回null
|
||||
if (nodeList === undefined) {
|
||||
return null;
|
||||
}
|
||||
// // 若目标node不存在,返回null
|
||||
// if (nodeList === undefined) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
targetNode = nodeList.find(item => item.sourceId === targetId);
|
||||
// targetNode = nodeList.find(item => item.sourceId === targetId);
|
||||
return targetNode || null;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,12 +67,19 @@ export default Util.registerShape(
|
||||
draggable: true
|
||||
});
|
||||
}
|
||||
let parent = cfg.parent || cfg.l_parent || cfg.r_parent;
|
||||
const isLeftEmpty =
|
||||
!cfg.child || cfg.child[0] === undefined || cfg.child[0] === undefined || cfg.child[0] == '0x0',
|
||||
isRightEmpty =
|
||||
!cfg.child || cfg.child[1] === undefined || cfg.child[1] === undefined || cfg.child[1] == '0x0',
|
||||
isparentEmpty = cfg.parent == "0x0" || cfg.l_parent == "0x0" || cfg.r_parent == "0x0";
|
||||
|
||||
isparentEmpty = parent[0] == "0x0";
|
||||
|
||||
|
||||
// console.log(cfg.id);
|
||||
// console.log(parent);
|
||||
|
||||
// console.log(isparentEmpty);
|
||||
|
||||
|
||||
if (isparentEmpty) {
|
||||
{
|
||||
@@ -140,6 +147,7 @@ export default Util.registerShape(
|
||||
[0.5, 0],
|
||||
[0.5, 0.125],
|
||||
[0.6, 1],
|
||||
[0.5,1]
|
||||
];
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user