3
3
4
4
namespace Toolbox . Editor . Hierarchy
5
5
{
6
+ /// <summary>
7
+ /// Dedicates utility class used to draw horizontal/vertical lines when rendering tree connection lines within the Hierarchy window.
8
+ /// </summary>
6
9
internal static class HierarchyTreeUtility
7
10
{
8
11
private const float dashLength = 4.0f ;
@@ -15,12 +18,12 @@ private static Rect GetLineRect(Rect rect, float thickness, float padding, bool
15
18
: new Rect ( rect . x + padding / 2 , rect . y , thickness , rect . height ) ;
16
19
}
17
20
18
- private static void DrawVerticalLine ( Rect rect , bool isDashed , float tickness , Color color )
21
+ public static void DrawVerticalLine ( Rect rect , bool isDashed , float tickness , Color color )
19
22
{
20
23
DrawVerticalLine ( rect , isDashed , tickness , color , 0.0f ) ;
21
24
}
22
25
23
- private static void DrawVerticalLine ( Rect rect , bool isDashed , float tickness , Color color , float paddingOffset )
26
+ public static void DrawVerticalLine ( Rect rect , bool isDashed , float tickness , Color color , float paddingOffset )
24
27
{
25
28
rect = GetLineRect ( rect , tickness , rect . width - paddingOffset , false ) ;
26
29
if ( ! isDashed )
@@ -44,12 +47,12 @@ private static void DrawVerticalLine(Rect rect, bool isDashed, float tickness, C
44
47
}
45
48
}
46
49
47
- private static void DrawHorizontalLine ( Rect rect , bool isDashed , float tickness , Color color )
50
+ public static void DrawHorizontalLine ( Rect rect , bool isDashed , float tickness , Color color )
48
51
{
49
52
DrawHorizontalLine ( rect , isDashed , tickness , color , 0.0f ) ;
50
53
}
51
54
52
- private static void DrawHorizontalLine ( Rect rect , bool isDashed , float tickness , Color color , float paddingOffset )
55
+ public static void DrawHorizontalLine ( Rect rect , bool isDashed , float tickness , Color color , float paddingOffset )
53
56
{
54
57
rect = GetLineRect ( rect , tickness , rect . height - paddingOffset , true ) ;
55
58
if ( ! isDashed )
@@ -73,11 +76,21 @@ private static void DrawHorizontalLine(Rect rect, bool isDashed, float tickness,
73
76
}
74
77
}
75
78
79
+ public static void DrawPassingLine ( Rect rect , bool isDashed , float tickness , Color color )
80
+ {
81
+ DrawPassingLine ( rect , isDashed , tickness , color , Vector2 . zero ) ;
82
+ }
83
+
76
84
public static void DrawPassingLine ( Rect rect , bool isDashed , float tickness , Color color , Vector2 paddingOffset )
77
85
{
78
86
DrawVerticalLine ( rect , isDashed , tickness , color , paddingOffset . x ) ;
79
87
}
80
88
89
+ public static void DrawCornerLine ( Rect rect , bool isDashed , float tickness , Color color )
90
+ {
91
+ DrawCornerLine ( rect , isDashed , tickness , color , Vector2 . zero , 0.0f ) ;
92
+ }
93
+
81
94
public static void DrawCornerLine ( Rect rect , bool isDashed , float tickness , Color color , Vector2 paddingOffset , float horizontalSizeOffset )
82
95
{
83
96
//NOTE: -1 as a offset for halfs in corners
@@ -91,6 +104,11 @@ public static void DrawCornerLine(Rect rect, bool isDashed, float tickness, Colo
91
104
DrawHorizontalLine ( horizontalRect , isDashed , tickness , color , paddingOffset . y ) ;
92
105
}
93
106
107
+ public static void DrawCrossLine ( Rect rect , bool isDashed , float tickness , Color color )
108
+ {
109
+ DrawCrossLine ( rect , isDashed , tickness , color , Vector2 . zero , 0.0f ) ;
110
+ }
111
+
94
112
public static void DrawCrossLine ( Rect rect , bool isDashed , float tickness , Color color , Vector2 paddingOffset , float horizontalSizeOffset )
95
113
{
96
114
DrawVerticalLine ( rect , isDashed , tickness , color , paddingOffset . x ) ;
0 commit comments