Skip to content

Commit

Permalink
Resize ranges fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ecton committed Sep 14, 2024
1 parent e34d06a commit b5cdb93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion src/widgets/resize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)),
},
}
}

0 comments on commit b5cdb93

Please sign in to comment.