@@ -9,43 +9,44 @@ namespace UnityEditor
99{
1010 public sealed partial class Handles
1111 {
12- internal static Vector2 DoRectHandles ( Quaternion rotation , Vector3 position , Vector2 size )
12+ internal static Vector2 DoRectHandles ( Quaternion rotation , Vector3 position , Vector2 size , bool handlesOnly )
1313 {
14- Vector3 forward = rotation * Vector3 . forward ;
1514 Vector3 up = rotation * Vector3 . up ;
1615 Vector3 right = rotation * Vector3 . right ;
1716
1817 float halfWidth = 0.5f * size . x ;
1918 float halfHeight = 0.5f * size . y ;
2019
21- Vector3 topRight = position + up * halfHeight + right * halfWidth ;
22- Vector3 bottomRight = position - up * halfHeight + right * halfWidth ;
23- Vector3 bottomLeft = position - up * halfHeight - right * halfWidth ;
24- Vector3 topLeft = position + up * halfHeight - right * halfWidth ;
20+ if ( ! handlesOnly )
21+ {
22+ Vector3 topRight = position + up * halfHeight + right * halfWidth ;
23+ Vector3 bottomRight = position - up * halfHeight + right * halfWidth ;
24+ Vector3 bottomLeft = position - up * halfHeight - right * halfWidth ;
25+ Vector3 topLeft = position + up * halfHeight - right * halfWidth ;
2526
26- // Draw rectangle
27- DrawLine ( topRight , bottomRight ) ;
28- DrawLine ( bottomRight , bottomLeft ) ;
29- DrawLine ( bottomLeft , topLeft ) ;
30- DrawLine ( topLeft , topRight ) ;
27+ // Draw rectangle
28+ DrawLine ( topRight , bottomRight ) ;
29+ DrawLine ( bottomRight , bottomLeft ) ;
30+ DrawLine ( bottomLeft , topLeft ) ;
31+ DrawLine ( topLeft , topRight ) ;
32+ }
3133
3234 // Give handles twice the alpha of the lines
33- Color col = Handles . color ;
34- col . a = Mathf . Clamp01 ( col . a * 2 ) ;
35- Handles . color = col ;
35+ Color origCol = color ;
36+ Color col = color ;
37+ col . a = Mathf . Clamp01 ( color . a * 2 ) ;
38+ color = ToActiveColorSpace ( col ) ;
3639
3740 // Draw handles
3841 halfHeight = SizeSlider ( position , up , halfHeight ) ;
3942 halfHeight = SizeSlider ( position , - up , halfHeight ) ;
4043 halfWidth = SizeSlider ( position , right , halfWidth ) ;
4144 halfWidth = SizeSlider ( position , - right , halfWidth ) ;
4245
43- // Draw the area light's normal only if it will not overlap with the current tool
44- if ( ! ( ( Tools . current == Tool . Move || Tools . current == Tool . Scale ) && Tools . pivotRotation == PivotRotation . Local ) )
45- DrawLine ( position , position + forward ) ;
46+ size . x = Mathf . Max ( 0f , 2.0f * halfWidth ) ;
47+ size . y = Mathf . Max ( 0f , 2.0f * halfHeight ) ;
4648
47- size . x = 2.0f * halfWidth ;
48- size . y = 2.0f * halfHeight ;
49+ color = origCol ;
4950
5051 return size ;
5152 }
0 commit comments