From fd8f980b88df260ce49d46ed6c514f6e382c6494 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 27 Mar 2023 14:40:03 +0200 Subject: Use `max_cross` if all elements are fluid in `layout::flex` --- core/src/layout/flex.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'core/src/layout') diff --git a/core/src/layout/flex.rs b/core/src/layout/flex.rs index 5ae98b8c..9a4b2cbf 100644 --- a/core/src/layout/flex.rs +++ b/core/src/layout/flex.rs @@ -123,11 +123,11 @@ where let max_cross = match axis { Axis::Horizontal => match height { - Length::Shrink => cross, + Length::Shrink if cross > 0.0 => cross, _ => max_cross, }, Axis::Vertical => match width { - Length::Shrink => cross, + Length::Shrink if cross > 0.0 => cross, _ => max_cross, }, }; @@ -154,8 +154,7 @@ where let (min_width, min_height) = axis.pack(min_main, axis.cross(limits.min())); - let (max_width, max_height) = axis - .pack(max_main, max_cross * fill_cross_factor.max(1) as f32); + let (max_width, max_height) = axis.pack(max_main, max_cross); let child_limits = Limits::new( Size::new(min_width, min_height), -- cgit