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

+10
View File
@@ -145,6 +145,16 @@ impl Widgets {
self.needs_redraw.insert(id);
}
/// Changes the preferred length without changing its bounds.
pub fn set_len(&mut self, id: impl IdLike, axis: Axis, len: impl Into<crate::SizeRequest>) {
let id = id.id();
let rule = SizeRule {
request: Some(len.into()),
bound: self.size_rules(id)[axis].bound,
};
self.set_size_rule(id, axis, rule);
}
/// Puts a floor under this widget's length on one axis, keeping a cap it
/// already had. See [`SizeRule::at_least`].
pub fn set_min_len(&mut self, id: impl IdLike, axis: Axis, min: Len) {