Resize ranges fix

This commit is contained in:
Jonathan Johnson 2024-09-14 08:35:26 -07:00
parent e34d06ac13
commit b5cdb93bb5
No known key found for this signature in database
GPG key ID: A66D6A34D6620579
2 changed files with 7 additions and 1 deletions

View file

@ -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

View file

@ -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),
)),
},
}
}