11using System ;
2+ using System . Drawing ;
23using ReClassNET ;
34using ReClassNET . Memory ;
45using ReClassNET . Nodes ;
@@ -30,17 +31,20 @@ public override void Intialize()
3031 /// <param name="view">The view information.</param>
3132 /// <param name="x">The x coordinate.</param>
3233 /// <param name="y">The y coordinate.</param>
33- /// <returns>The height the node occupies.</returns>
34- public override int Draw ( ViewInfo view , int x , int y )
34+ /// <returns>The pixel size the node occupies.</returns>
35+ public override Size Draw ( ViewInfo view , int x , int y )
3536 {
3637 if ( IsHidden )
3738 {
3839 return DrawHidden ( view , x , y ) ;
3940 }
4041
42+ var origX = x ;
43+ var origY = y ;
44+
4145 AddSelection ( view , x , y , view . Font . Height ) ;
42- AddDelete ( view , x , y ) ;
43- AddTypeDrop ( view , x , y ) ;
46+ AddDelete ( view , y ) ;
47+ AddTypeDrop ( view , y ) ;
4448
4549 x = AddOpenClose ( view , x , y ) ;
4650 x = AddIcon ( view , x , y , Icons . Pointer , - 1 , HotSpotType . None ) ;
@@ -58,6 +62,8 @@ public override int Draw(ViewInfo view, int x, int y)
5862
5963 y += view . Font . Height ;
6064
65+ var size = new Size ( x - origX , y - origY ) ;
66+
6167 if ( levelsOpen [ view . Level ] )
6268 {
6369 var ptr = view . Memory . ReadObject < IntPtr > ( Offset ) ;
@@ -78,16 +84,19 @@ public override int Draw(ViewInfo view, int x, int y)
7884 v . Address = ptr ;
7985 v . Memory = memory ;
8086
81- y = InnerNode . Draw ( v , tx , y ) ;
87+ var innerSize = InnerNode . Draw ( v , tx , y ) ;
88+
89+ size . Width = Math . Max ( size . Width , innerSize . Width + tx - origX ) ;
90+ size . Height += innerSize . Height ;
8291 }
8392
84- return y ;
93+ return size ;
8594 }
8695
8796 /// <summary>Calculates the height of the node.</summary>
8897 /// <param name="view">The view information.</param>
8998 /// <returns>The calculated height.</returns>
90- public override int CalculateHeight ( ViewInfo view )
99+ public override int CalculateDrawnHeight ( ViewInfo view )
91100 {
92101 if ( IsHidden )
93102 {
@@ -97,7 +106,7 @@ public override int CalculateHeight(ViewInfo view)
97106 var h = view . Font . Height ;
98107 if ( levelsOpen [ view . Level ] )
99108 {
100- h += InnerNode . CalculateHeight ( view ) ;
109+ h += InnerNode . CalculateDrawnHeight ( view ) ;
101110 }
102111 return h ;
103112 }
0 commit comments