diff --git a/CHANGELOG.md b/CHANGELOG.md index aa110fa2f..e57e9de7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `inner_size` and `outer_size` are now initialized after the first layout is performed. This ensures that when `resize_to_fit` is used, the first observed values will be the resized values. +- `Resize` now performs a second layout pass, if necessary, to ensure that + children widgets have an opportunity to fill the resized area. Additionally, + the first SizeToFit measurement will be performed with the minimum dimension. ### Added diff --git a/src/widgets/resize.rs b/src/widgets/resize.rs index 195cf9410..f2d8c8eb6 100644 --- a/src/widgets/resize.rs +++ b/src/widgets/resize.rs @@ -142,7 +142,10 @@ fn override_constraint( ConstraintLimit::Fill(size) => ConstraintLimit::Fill(range.clamp(size, scale)), ConstraintLimit::SizeToFit(clipped_after) => match (range.minimum(), range.maximum()) { (Some(min), Some(max)) if min == max => ConstraintLimit::Fill(min.into_upx(scale)), - _ => ConstraintLimit::SizeToFit(range.clamp(clipped_after, scale)), + _ => ConstraintLimit::SizeToFit(range.minimum().map_or_else( + || range.clamp(clipped_after, scale), + |min| min.into_upx(scale), + )), }, } }