Skip to content

Commit 70d93c9

Browse files
committed
🐛 修复节点转换成框时,外部连线的文字和颜色状态没有保留的bug
1 parent 0f5dfc4 commit 70d93c9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

app/src/core/stage/stageManager/concreteMethods/StageSectionPackManager.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { StageHistoryManager } from "../StageHistoryManager";
1212
import { StageManager } from "../StageManager";
1313
import { StageManagerUtils } from "./StageManagerUtils";
1414
import { StageSectionInOutManager } from "./StageSectionInOutManager";
15+
import { Edge } from "../../stageObject/association/Edge";
1516

1617
/**
1718
* 管理所有东西进出StageSection的逻辑
@@ -135,28 +136,27 @@ export namespace StageSectionPackManager {
135136
details: textNode.details,
136137
});
137138
newSection.adjustLocationAndSize();
138-
// 获取所有连向它的和它连向的东西
139-
const fatherConnections = GraphMethods.nodeParentArray(textNode);
140-
const childConnections = GraphMethods.nodeChildrenArray(textNode);
141139

142-
// 删除原来的textNode
143-
StageManager.deleteEntities([textNode]);
144140
// 将新的Section加入舞台
145141
StageManager.addSection(newSection);
146142
for (const fatherSection of fatherSections) {
147143
StageSectionInOutManager.goInSection([newSection], fatherSection);
148144
}
149145

150146
if (!ignoreEdges) {
151-
// 将所有连向它的东西连到新的Section
152-
for (const fatherConnection of fatherConnections) {
153-
StageManager.connectEntity(fatherConnection, newSection);
154-
}
155-
// 将所有连向新的Section的东西连到它
156-
for (const childConnection of childConnections) {
157-
StageManager.connectEntity(newSection, childConnection);
147+
for (const edge of StageManager.getAssociations()) {
148+
if (edge instanceof Edge) {
149+
if (edge.target.uuid === textNode.uuid) {
150+
edge.target = newSection;
151+
}
152+
if (edge.source.uuid === textNode.uuid) {
153+
edge.source = newSection;
154+
}
155+
}
158156
}
159157
}
158+
// 删除原来的textNode
159+
StageManager.deleteEntities([textNode]);
160160
// 更新section的碰撞箱
161161
newSection.adjustLocationAndSize();
162162
return newSection;

0 commit comments

Comments
 (0)