File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
app/src/core/stage/stageManager/concreteMethods Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,24 @@ export namespace StageNodeAdder {
114114 const distance = newNode . rectangle . left - entityRectangle . left ;
115115 newNode . moveTo ( newNode . rectangle . location . add ( new Vector ( - distance , 0 ) ) ) ;
116116 }
117+ if ( direction === Direction . Left ) {
118+ // 顶对齐
119+ const distance = newNode . rectangle . top - entityRectangle . top ;
120+ newNode . moveTo ( newNode . rectangle . location . add ( new Vector ( 0 , - distance ) ) ) ;
121+ }
122+ if ( direction === Direction . Right ) {
123+ // 顶对齐,+ 自己对齐到目标的右侧
124+ const targetLocation = entityRectangle . rightTop ;
125+ newNode . moveTo ( targetLocation ) ;
126+ }
127+ if ( direction === Direction . Up ) {
128+ const targetLocation = entityRectangle . leftTop . add ( new Vector ( 0 , newNode . collisionBox . getRectangle ( ) . height ) ) ;
129+ newNode . moveTo ( targetLocation ) ;
130+ }
131+ if ( direction === Direction . Down ) {
132+ const targetLocation = entityRectangle . leftBottom ;
133+ newNode . moveTo ( targetLocation ) ;
134+ }
117135 StageHistoryManager . recordStep ( ) ;
118136 return uuid ;
119137 }
You can’t perform that action at this time.
0 commit comments