Skip to content

Commit 9c07b2c

Browse files
committed
🐛 通过tab和反斜杠生长的节点若父节点在框中,新生成的节点也自动纳入到框中
1 parent 3ea741e commit 9c07b2c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

app/src/core/service/controlService/keyboardOnlyEngine/keyboardOnlyTreeEngine.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { TextNode } from "../../../stage/stageObject/entity/TextNode";
1010
import { editTextNode } from "../controller/concrete/utilsControl";
1111
import { Direction } from "../../../../types/directions";
1212
import { KeyboardOnlyEngine } from "./keyboardOnlyEngine";
13+
import { SectionMethods } from "../../../stage/stageManager/basicMethods/SectionMethods";
1314

1415
/**
1516
* 专用于Xmind式的树形结构的键盘操作引擎
@@ -52,6 +53,14 @@ export namespace KeyboardOnlyTreeEngine {
5253
sizeAdjust: rootNode instanceof TextNode ? rootNode.sizeAdjust : "auto",
5354
});
5455
StageManager.addTextNode(newNode);
56+
57+
// 如果是在框里,则把新生长的节点也纳入到框里
58+
const fatherSections = SectionMethods.getFatherSections(rootNode);
59+
for (const section of fatherSections) {
60+
section.childrenUUIDs.push(newNode.uuid);
61+
section.children.push(newNode);
62+
}
63+
5564
// 连接节点
5665
StageManager.connectEntity(rootNode, newNode);
5766
const newEdges = GraphMethods.getEdgesBetween(rootNode, newNode);
@@ -117,6 +126,12 @@ export namespace KeyboardOnlyTreeEngine {
117126
sizeAdjust: parent instanceof TextNode ? parent.sizeAdjust : "auto",
118127
});
119128
StageManager.addTextNode(newNode);
129+
// 如果是在框里,则把新生长的节点也纳入到框里
130+
const fatherSections = SectionMethods.getFatherSections(parent);
131+
for (const section of fatherSections) {
132+
section.childrenUUIDs.push(newNode.uuid);
133+
section.children.push(newNode);
134+
}
120135
// 连接节点
121136
StageManager.connectEntity(parent, newNode);
122137

0 commit comments

Comments
 (0)