|
@@ -61,6 +61,7 @@ export class WorkflowOperationBaseServiceImpl
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const oldNodes = this.document.getAllNodes();
|
|
const oldNodes = this.document.getAllNodes();
|
|
|
|
|
+ const oldEdges = this.linesManager.getAllLines();
|
|
|
const oldPositionMap = new Map<string, IPoint>(
|
|
const oldPositionMap = new Map<string, IPoint>(
|
|
|
oldNodes.map((node) => [
|
|
oldNodes.map((node) => [
|
|
|
node.id,
|
|
node.id,
|
|
@@ -74,15 +75,21 @@ export class WorkflowOperationBaseServiceImpl
|
|
|
const newNodes: WorkflowNodeEntity[] = [];
|
|
const newNodes: WorkflowNodeEntity[] = [];
|
|
|
const newEdges: WorkflowLineEntity[] = [];
|
|
const newEdges: WorkflowLineEntity[] = [];
|
|
|
|
|
|
|
|
- // 清空线条
|
|
|
|
|
- this.linesManager.getAllLines().map((line) => line.dispose());
|
|
|
|
|
-
|
|
|
|
|
// 逐层渲染
|
|
// 逐层渲染
|
|
|
this.document.batchAddFromJSON(workflowJSON, {
|
|
this.document.batchAddFromJSON(workflowJSON, {
|
|
|
onNodeCreated: (node) => newNodes.push(node),
|
|
onNodeCreated: (node) => newNodes.push(node),
|
|
|
onEdgeCreated: (edge) => newEdges.push(edge),
|
|
onEdgeCreated: (edge) => newEdges.push(edge),
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ const newEdgeIDSet = new Set<string>(newEdges.map((edge) => edge.id));
|
|
|
|
|
+ oldEdges.forEach((edge) => {
|
|
|
|
|
+ // 清空旧线条
|
|
|
|
|
+ if (!newEdgeIDSet.has(edge.id)) {
|
|
|
|
|
+ edge.dispose();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
const newNodeIDSet = new Set<string>(newNodes.map((node) => node.id));
|
|
const newNodeIDSet = new Set<string>(newNodes.map((node) => node.id));
|
|
|
oldNodes.forEach((node) => {
|
|
oldNodes.forEach((node) => {
|
|
|
// 清空旧节点
|
|
// 清空旧节点
|