@@ -827,7 +827,7 @@ pub fn Display(comptime T: type) type {
827827 },
828828 .shrinks = > {
829829 // Shrink to the smallest the children will allow
830- const new_height = element .shrink_height (self , available_width );
830+ const new_height = element .minimum_needed_height (self , available_width );
831831 if (element .rect .height != new_height ) {
832832 element .rect .height = new_height ;
833833 child_resized = true ;
@@ -3136,7 +3136,7 @@ test "button sizing" {
31363136 .layout = .{ .x = .shrinks , .y = .shrinks },
31373137 });
31383138 try eq (5 , panel .minimum_needed_width (display , 500 ));
3139- try eq (8 , panel .shrink_height (display , 500 ));
3139+ try eq (8 , panel .minimum_needed_height (display , 500 ));
31403140
31413141 const not_quite_one_line = display .text_height .pixel_height (display .scale ) - 5 ;
31423142 const not_quite_two_lines = display .text_height .pixel_height (display .scale ) * 2 - 5 ;
@@ -3150,12 +3150,12 @@ test "button sizing" {
31503150 });
31513151 display .relayout ();
31523152 try eq (50 , button .minimum_needed_width (display , 500 ));
3153- try eq (50 , button .shrink_height (display , 500 ));
3153+ try eq (50 , button .minimum_needed_height (display , 500 ));
31543154 button .layout .x = .shrinks ;
31553155 button .layout .y = .shrinks ;
31563156 try eq (30 , button .minimum_needed_width (display , 500 ));
31573157 // The words will overflow the bottom of the box
3158- try eq (not_quite_one_line , button .shrink_height (display , 500 ));
3158+ try eq (not_quite_one_line , button .minimum_needed_height (display , 500 ));
31593159
31603160 display .relayout ();
31613161 try eq (30 , panel .minimum_needed_width (display , 500 ));
@@ -3236,7 +3236,7 @@ test "text input sizing" {
32363236 defer l .destroy (allocator , display );
32373237 l .pad = .{ .top = 0 , .bottom = 0 , .left = 0 , .right = 0 };
32383238 try eq (500 , l .minimum_needed_width (display , 500 ));
3239- try eq (50 , l .shrink_height (display , 500 ));
3239+ try eq (50 , l .minimum_needed_height (display , 500 ));
32403240 }
32413241
32423242 {
@@ -3252,7 +3252,7 @@ test "text input sizing" {
32523252 defer l .destroy (allocator , display );
32533253 l .pad = .{ .top = 0 , .bottom = 0 , .left = 0 , .right = 0 };
32543254 try eq (500 , l .minimum_needed_width (display , 500 ));
3255- try eq (60 , l .shrink_height (display , 500 ));
3255+ try eq (60 , l .minimum_needed_height (display , 500 ));
32563256 }
32573257
32583258 {
@@ -3268,7 +3268,7 @@ test "text input sizing" {
32683268 defer l .destroy (allocator , display );
32693269 l .pad = .{ .top = 0 , .bottom = 0 , .left = 0 , .right = 0 };
32703270 try eq (401 , l .minimum_needed_width (display , 500 ));
3271- try eq (display .text_height .pixel_height (display .scale ), l .shrink_height (display , 500 ));
3271+ try eq (display .text_height .pixel_height (display .scale ), l .minimum_needed_height (display , 500 ));
32723272 }
32733273
32743274 {
@@ -3284,7 +3284,7 @@ test "text input sizing" {
32843284 defer l .destroy (allocator , display );
32853285 l .pad = .{ .top = 0 , .bottom = 0 , .left = 0 , .right = 0 };
32863286 try eq (401 , @round (l .minimum_needed_width (display , 500 )));
3287- try eq (display .text_height .pixel_height (display .pixel_scale ), l .shrink_height (display , 500 ));
3287+ try eq (display .text_height .pixel_height (display .pixel_scale ), l .minimum_needed_height (display , 500 ));
32883288 }
32893289
32903290 {
@@ -3307,9 +3307,9 @@ test "text input sizing" {
33073307
33083308 // Display width of the words when rendered to the physical display
33093309 try eq (94 , @round (l .minimum_needed_width (display , 500 ) / display .pixel_scale ));
3310- try eq (display .text_height .pixel_height (display .pixel_scale ), l .shrink_height (display , 500 ));
3310+ try eq (display .text_height .pixel_height (display .pixel_scale ), l .minimum_needed_height (display , 500 ));
33113311 // Display width on physical display with word wrap
3312- try eq (2 * display .text_height .pixel_height (display .pixel_scale ), l .shrink_height (display , 40 * display .pixel_scale ));
3312+ try eq (2 * display .text_height .pixel_height (display .pixel_scale ), l .minimum_needed_height (display , 40 * display .pixel_scale ));
33133313 }
33143314
33153315 var panel = try display .add_panel (allocator , .{
@@ -3319,7 +3319,7 @@ test "text input sizing" {
33193319 .layout = .{ .x = .shrinks , .y = .shrinks },
33203320 });
33213321 try eq (5 , panel .minimum_needed_width (display , 500 ));
3322- try eq (8 , panel .shrink_height (display , 500 ));
3322+ try eq (8 , panel .minimum_needed_height (display , 500 ));
33233323
33243324 // Fixed width and height cant be shrunk or grown, except if minimum
33253325 // or maximum override it.
@@ -3333,7 +3333,7 @@ test "text input sizing" {
33333333 });
33343334 label .pad = .{ .top = 0 , .bottom = 0 , .left = 0 , .right = 0 };
33353335 try eq (500 , label .minimum_needed_width (display , 500 ));
3336- try eq (60 , label .shrink_height (display , 500 ));
3336+ try eq (60 , label .minimum_needed_height (display , 500 ));
33373337
33383338 // Fixed width and height cant be shrunk or grown, except if minimum
33393339 // or maximum override it.
@@ -3347,14 +3347,14 @@ test "text input sizing" {
33473347 });
33483348 label .pad = .{ .top = 0 , .bottom = 0 , .left = 0 , .right = 0 };
33493349 try eq (300 , label .minimum_needed_width (display , 500 ));
3350- try eq (100 , label .shrink_height (display , 500 ));
3350+ try eq (100 , label .minimum_needed_height (display , 500 ));
33513351
33523352 label .minimum .width = display .text_height .pixel_height (1 );
33533353 label .minimum .height = display .text_height .pixel_height (1 );
33543354 label .layout .x = .shrinks ;
33553355 label .layout .y = .shrinks ;
33563356 try eq (94 , @round (label .minimum_needed_width (display , 500 ) / display .pixel_scale ));
3357- try eq (display .text_height .pixel_height (1 ), @round (label .shrink_height (display , 500 ) / display .pixel_scale ));
3357+ try eq (display .text_height .pixel_height (1 ), @round (label .minimum_needed_height (display , 500 ) / display .pixel_scale ));
33583358 label .layout .x = .grows ;
33593359 try eq (401 , @round (label .minimum_needed_width (display , 500 )));
33603360
0 commit comments