@@ -20,11 +20,11 @@ import {
2020 AlignCenterVertical ,
2121 AlignEndHorizontal ,
2222 AlignEndVertical ,
23- AlignHorizontalJustifyEnd ,
23+ AlignHorizontalJustifyStart ,
2424 AlignHorizontalSpaceBetween ,
2525 AlignStartHorizontal ,
2626 AlignStartVertical ,
27- AlignVerticalJustifyEnd ,
27+ AlignVerticalJustifyStart ,
2828 AlignVerticalSpaceBetween ,
2929 ArrowDownUp ,
3030 ArrowLeftRight ,
@@ -118,6 +118,63 @@ export default function MyContextMenuContent() {
118118
119119 { /* 对齐面板 */ }
120120 < Item className = "bg-transparent! gap-0 p-0" >
121+ { p . stageManager . getSelectedEntities ( ) . length >= 2 && (
122+ < div className = "grid grid-cols-3 grid-rows-3" >
123+ < KeyTooltip keyId = "alignTop" >
124+ < Button variant = "ghost" size = "icon" className = "size-6" onClick = { ( ) => p . layoutManager . alignTop ( ) } >
125+ < AlignStartHorizontal />
126+ </ Button >
127+ </ KeyTooltip >
128+ < KeyTooltip keyId = "alignTopToBottomNoSpace" >
129+ < Button
130+ variant = "ghost"
131+ size = "icon"
132+ className = "size-6"
133+ onClick = { ( ) => p . layoutManager . alignTopToBottomNoSpace ( ) }
134+ >
135+ < AlignVerticalJustifyStart />
136+ </ Button >
137+ </ KeyTooltip >
138+ < div />
139+ < KeyTooltip keyId = "alignCenterHorizontal" >
140+ < Button
141+ variant = "ghost"
142+ size = "icon"
143+ className = "size-6"
144+ onClick = { ( ) => p . layoutManager . alignCenterHorizontal ( ) }
145+ >
146+ < AlignCenterHorizontal />
147+ </ Button >
148+ </ KeyTooltip >
149+
150+ < KeyTooltip keyId = "alignVerticalSpaceBetween" >
151+ < Button
152+ variant = "ghost"
153+ size = "icon"
154+ className = "size-6"
155+ onClick = { ( ) => p . layoutManager . alignVerticalSpaceBetween ( ) }
156+ >
157+ < AlignVerticalSpaceBetween />
158+ </ Button >
159+ </ KeyTooltip >
160+ < KeyTooltip keyId = "layoutToSquare" >
161+ < Button
162+ variant = "ghost"
163+ size = "icon"
164+ className = "size-6"
165+ onClick = { ( ) => p . layoutManager . layoutToSquare ( p . stageManager . getSelectedEntities ( ) ) }
166+ >
167+ < Grip />
168+ </ Button >
169+ </ KeyTooltip >
170+
171+ < KeyTooltip keyId = "alignBottom" >
172+ < Button variant = "ghost" size = "icon" className = "size-6" onClick = { ( ) => p . layoutManager . alignBottom ( ) } >
173+ < AlignEndHorizontal />
174+ </ Button >
175+ </ KeyTooltip >
176+ </ div >
177+ ) }
121178 { p . stageManager . getSelectedEntities ( ) . length >= 2 && (
122179 < div className = "grid grid-cols-3 grid-rows-3" >
123180 < KeyTooltip keyId = "alignLeft" >
@@ -140,26 +197,17 @@ export default function MyContextMenuContent() {
140197 < AlignEndVertical />
141198 </ Button >
142199 </ KeyTooltip >
143- < KeyTooltip keyId = "alignTop" >
144- < Button variant = "ghost" size = "icon" className = "size-6" onClick = { ( ) => p . layoutManager . alignTop ( ) } >
145- < AlignStartHorizontal />
146- </ Button >
147- </ KeyTooltip >
148- < KeyTooltip keyId = "alignCenterHorizontal" >
200+ < KeyTooltip keyId = "alignLeftToRightNoSpace" >
149201 < Button
150202 variant = "ghost"
151203 size = "icon"
152204 className = "size-6"
153- onClick = { ( ) => p . layoutManager . alignCenterHorizontal ( ) }
205+ onClick = { ( ) => p . layoutManager . alignLeftToRightNoSpace ( ) }
154206 >
155- < AlignCenterHorizontal />
156- </ Button >
157- </ KeyTooltip >
158- < KeyTooltip keyId = "alignBottom" >
159- < Button variant = "ghost" size = "icon" className = "size-6" onClick = { ( ) => p . layoutManager . alignBottom ( ) } >
160- < AlignEndHorizontal />
207+ < AlignHorizontalJustifyStart />
161208 </ Button >
162209 </ KeyTooltip >
210+
163211 < KeyTooltip keyId = "alignHorizontalSpaceBetween" >
164212 < Button
165213 variant = "ghost"
@@ -170,45 +218,44 @@ export default function MyContextMenuContent() {
170218 < AlignHorizontalSpaceBetween />
171219 </ Button >
172220 </ KeyTooltip >
173- < KeyTooltip keyId = "layoutToSquare" >
221+
222+ < div />
223+
224+ < KeyTooltip keyId = "adjustSelectedTextNodeWidthMin" >
174225 < Button
175226 variant = "ghost"
176227 size = "icon"
177228 className = "size-6"
178- onClick = { ( ) => p . layoutManager . layoutToSquare ( p . stageManager . getSelectedEntities ( ) ) }
229+ onClick = { ( ) => p . layoutManager . adjustSelectedTextNodeWidth ( "minWidth" ) }
179230 >
180- < Grip />
231+ < ChevronsRightLeft />
181232 </ Button >
182233 </ KeyTooltip >
183- < KeyTooltip keyId = "alignVerticalSpaceBetween " >
234+ < KeyTooltip keyId = "adjustSelectedTextNodeWidthAverage " >
184235 < Button
185236 variant = "ghost"
186237 size = "icon"
187238 className = "size-6"
188- onClick = { ( ) => p . layoutManager . alignVerticalSpaceBetween ( ) }
239+ onClick = { ( ) => p . layoutManager . adjustSelectedTextNodeWidth ( "average" ) }
189240 >
190- < AlignVerticalSpaceBetween />
241+ < MoveHorizontal />
191242 </ Button >
192243 </ KeyTooltip >
193- </ div >
194- ) }
195- < div className = "grid grid-cols-3 grid-rows-3" >
196- { selectedTreeRoot ? (
197- < KeyTooltip keyId = "treeReverseY" >
244+ < KeyTooltip keyId = "adjustSelectedTextNodeWidthMax" >
198245 < Button
199246 variant = "ghost"
200247 size = "icon"
201248 className = "size-6"
202- onClick = { ( ) =>
203- p . autoLayoutFastTree . treeReverseY ( p . stageManager . getSelectedEntities ( ) [ 0 ] as ConnectableEntity )
204- }
249+ onClick = { ( ) => p . layoutManager . adjustSelectedTextNodeWidth ( "maxWidth" ) }
205250 >
206- < ArrowDownUp />
251+ < Code />
207252 </ Button >
208253 </ KeyTooltip >
209- ) : (
210- < div />
211- ) }
254+ </ div >
255+ ) }
256+ </ Item >
257+ < Item className = "bg-transparent!" >
258+ < div >
212259 { selectedTreeRoot ? (
213260 < KeyTooltip keyId = "autoLayoutSelectedFastTreeModeRight" >
214261 < Button
@@ -227,98 +274,57 @@ export default function MyContextMenuContent() {
227274 ) : (
228275 < div />
229276 ) }
230- { p . stageManager . getSelectedEntities ( ) . length >= 2 ? (
231- < KeyTooltip keyId = "alignLeftToRightNoSpace" >
277+
278+ { selectedTreeRoot ? (
279+ < KeyTooltip keyId = "treeReverseX" >
232280 < Button
233281 variant = "ghost"
234282 size = "icon"
235283 className = "size-6"
236- onClick = { ( ) => p . layoutManager . alignLeftToRightNoSpace ( ) }
284+ onClick = { ( ) =>
285+ p . autoLayoutFastTree . treeReverseX ( p . stageManager . getSelectedEntities ( ) [ 0 ] as ConnectableEntity )
286+ }
237287 >
238- < AlignHorizontalJustifyEnd />
288+ < ArrowLeftRight />
239289 </ Button >
240290 </ KeyTooltip >
241291 ) : (
242292 < div />
243293 ) }
244294 { selectedTreeRoot ? (
245- < KeyTooltip keyId = "treeReverseX " >
295+ < KeyTooltip keyId = "autoLayoutSelectedFastTreeModeDown " >
246296 < Button
247297 variant = "ghost"
248298 size = "icon"
249299 className = "size-6"
250300 onClick = { ( ) =>
251- p . autoLayoutFastTree . treeReverseX ( p . stageManager . getSelectedEntities ( ) [ 0 ] as ConnectableEntity )
301+ p . autoAlign . autoLayoutSelectedFastTreeModeDown (
302+ p . stageManager . getSelectedEntities ( ) [ 0 ] as ConnectableEntity ,
303+ )
252304 }
253305 >
254- < ArrowLeftRight />
306+ < Network />
255307 </ Button >
256308 </ KeyTooltip >
257309 ) : (
258310 < div />
259311 ) }
260312 { selectedTreeRoot ? (
261- < KeyTooltip keyId = "autoLayoutSelectedFastTreeModeDown " >
313+ < KeyTooltip keyId = "treeReverseY " >
262314 < Button
263315 variant = "ghost"
264316 size = "icon"
265317 className = "size-6"
266318 onClick = { ( ) =>
267- p . autoAlign . autoLayoutSelectedFastTreeModeDown (
268- p . stageManager . getSelectedEntities ( ) [ 0 ] as ConnectableEntity ,
269- )
319+ p . autoLayoutFastTree . treeReverseY ( p . stageManager . getSelectedEntities ( ) [ 0 ] as ConnectableEntity )
270320 }
271321 >
272- < Network />
322+ < ArrowDownUp />
273323 </ Button >
274324 </ KeyTooltip >
275325 ) : (
276326 < div />
277327 ) }
278- { p . stageManager . getSelectedEntities ( ) . length >= 2 && (
279- < >
280- < KeyTooltip keyId = "alignTopToBottomNoSpace" >
281- < Button
282- variant = "ghost"
283- size = "icon"
284- className = "size-6"
285- onClick = { ( ) => p . layoutManager . alignTopToBottomNoSpace ( ) }
286- >
287- < AlignVerticalJustifyEnd />
288- </ Button >
289- </ KeyTooltip >
290- < KeyTooltip keyId = "adjustSelectedTextNodeWidthMin" >
291- < Button
292- variant = "ghost"
293- size = "icon"
294- className = "size-6"
295- onClick = { ( ) => p . layoutManager . adjustSelectedTextNodeWidth ( "minWidth" ) }
296- >
297- < ChevronsRightLeft />
298- </ Button >
299- </ KeyTooltip >
300- < KeyTooltip keyId = "adjustSelectedTextNodeWidthAverage" >
301- < Button
302- variant = "ghost"
303- size = "icon"
304- className = "size-6"
305- onClick = { ( ) => p . layoutManager . adjustSelectedTextNodeWidth ( "average" ) }
306- >
307- < MoveHorizontal />
308- </ Button >
309- </ KeyTooltip >
310- < KeyTooltip keyId = "adjustSelectedTextNodeWidthMax" >
311- < Button
312- variant = "ghost"
313- size = "icon"
314- className = "size-6"
315- onClick = { ( ) => p . layoutManager . adjustSelectedTextNodeWidth ( "maxWidth" ) }
316- >
317- < Code />
318- </ Button >
319- </ KeyTooltip >
320- </ >
321- ) }
322328 </ div >
323329 </ Item >
324330 { /* 存在选中实体 */ }
0 commit comments