File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
app/src/core/service/controlService/autoLayoutEngine Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { Rectangle } from "../../../dataStruct/shape/Rectangle";
88import { Vector } from "../../../dataStruct/Vector" ;
99import { GraphMethods } from "../../../stage/stageManager/basicMethods/GraphMethods" ;
1010import { StageEntityMoveManager } from "../../../stage/stageManager/concreteMethods/StageEntityMoveManager" ;
11+ import { StageManager } from "../../../stage/stageManager/StageManager" ;
1112import { ConnectableEntity } from "../../../stage/stageObject/abstract/ConnectableEntity" ;
1213export namespace AutoLayoutFastTree {
1314 /**
@@ -102,6 +103,8 @@ export namespace AutoLayoutFastTree {
102103 * @param rootNode
103104 */
104105 export function autoLayoutFastTreeModeRight ( rootNode : ConnectableEntity ) {
106+ const initLocation = rootNode . collisionBox . getRectangle ( ) . leftTop . clone ( ) ;
107+
105108 const dfs = ( node : ConnectableEntity ) => {
106109 const childList = GraphMethods . nodeChildrenArray ( node ) ;
107110 for ( const child of childList ) {
@@ -114,5 +117,11 @@ export namespace AutoLayoutFastTree {
114117 } ;
115118
116119 dfs ( rootNode ) ;
120+ // rootNode.moveTo(initLocation);
121+ const delta = initLocation . subtract ( rootNode . collisionBox . getRectangle ( ) . leftTop ) ;
122+ // 选中根节点
123+ StageManager . clearSelectAll ( ) ;
124+ rootNode . isSelected = true ;
125+ StageManager . moveConnectableEntitiesWithChildren ( delta ) ;
117126 }
118127}
You can’t perform that action at this time.
0 commit comments