Constrain offered boxes with independent widget size bounds

This commit is contained in:
iris-ai committed 2026-09-20 19:47:32 -04:00
1 parent 4cb6f6882a
commit 2ac0843cb2
18 files changed
+554 -379

No files matched your search

+5 -10
View File
@@ -350,9 +350,7 @@ impl Plan {
self.walk_mut(&mut |node| {
let Some(rules) = &mut node.size else { return };
for axis in Axis::BOTH {
if rules[axis].bound() != Bound::ANY {
rules[axis] = SizeRule::Free;
}
rules[axis].bound = Bound::ANY;
}
});
}
@@ -682,8 +680,8 @@ impl Sow<'_> {
match self.rng.below(8) {
0 | 1 => self.len().into(),
2 => LayoutLen::LEFTOVER.into(),
3 => SizeRule::Min(self.bound()),
4 => SizeRule::Max(self.bound()),
3 => SizeRule::min(self.bound()),
4 => SizeRule::max(self.bound()),
// Both in pixels, so one can be put under the other: a floor and
// a cap that change sides with the window bound nothing, which
// is a caller's bug rather than a tree to grow.
@@ -692,12 +690,9 @@ impl Sow<'_> {
Px::from_f32(20.0 + self.rng.below(180) as f32),
Px::from_f32(20.0 + self.rng.below(180) as f32),
);
SizeRule::Clamp {
min: Len::px(a.min(b).to_f32()),
max: Len::px(a.max(b).to_f32()),
}
SizeRule::clamp(Len::px(a.min(b).to_f32()), Len::px(a.max(b).to_f32()))
}
_ => SizeRule::Free,
_ => SizeRule::FREE,
}
}