@@ -24,34 +24,26 @@ internal static void Execute()
2424 if ( ox != 0 || oy != 0 )
2525 {
2626 evt . Use ( ) ;
27-
28- switch ( Settings . OperatorMode )
27+
28+ var offset2 = new Vector2 ( ox , oy ) ;
29+ var offset3 = new Vector3 ( ox , oy , 0 ) ;
30+ // shift change z for 3d
31+ if ( evt . shift )
32+ offset3 = new Vector3 ( 0 , 0 , ox + oy ) ;
33+ if ( evt . control )
34+ {
35+ offset2 *= 10 ;
36+ offset3 *= 10 ;
37+ }
38+
39+ foreach ( var trans in Utils . GetTransforms ( ) )
2940 {
30- case OperatorMode . UGUI :
31- var offset = new Vector2 ( ox , oy ) ;
32- if ( evt . control ) offset *= 10 ;
33- foreach ( var rt in Utils . GetRectTransforms ( ) )
34- {
35- Undo . RecordObject ( rt , "AdjustPosition" ) ;
36- rt . anchoredPosition += offset ;
37- }
38- break ;
39- case OperatorMode . World :
40- if ( evt . shift )
41- {
42- oz = ox + oy ;
43- ox = oy = 0 ;
44- }
45- var offset3 = new Vector3 ( ox , oy , oz ) ;
46- if ( evt . control ) offset3 *= 10 ;
47- foreach ( var rt in Utils . GetWorldTransforms ( ) )
48- {
49- Undo . RecordObject ( rt , "AdjustPosition" ) ;
50- rt . position += offset3 ;
51- }
52- break ;
41+ Undo . RecordObject ( trans , "AdjustPosition" ) ;
42+ if ( trans is RectTransform )
43+ ( ( RectTransform ) trans ) . anchoredPosition += offset2 ;
44+ else
45+ trans . localPosition += offset3 ;
5346 }
54-
5547 }
5648 }
5749 }
0 commit comments