Skip to content

Commit

Permalink
Disclose now forces size to fit vertically
Browse files Browse the repository at this point in the history
The new Label behavior of honoring the `Fill` constraint caused the
Disclose widget to misbehave when a Label was used as the label when the
Disclose was being asked to fill a given space.

Since the Disclose widget is always vertical, it can make the assumption
it should overrule the layout requirements and always fit the label
vertically.
  • Loading branch information
ecton committed Dec 5, 2024
1 parent bcdd330 commit ff0a537
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/widgets/disclose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ impl Widget for DiscloseIndicator {

let label_size = if let Some(label) = &mut self.label {
let label = label.mounted(context);
let label_size = context.for_other(&label).layout(available_space);
let label_size = context.for_other(&label).layout(Size::new(
available_space.width,
ConstraintLimit::SizeToFit(available_space.height.max()),
));
let label_vertical_offset = if label_size.height < indicator_size {
(indicator_size - label_size.height).round()
} else {
Expand Down

0 comments on commit ff0a537

Please sign in to comment.