Retain layout sizes by pixel axis

This commit is contained in:
iris-ai committed 2026-09-14 17:47:21 -04:00
1 parent 82fa6c1123
commit b1b3eca1c0
11 files changed
+371 -69

No files matched your search

+7 -9
View File
@@ -15,16 +15,14 @@ impl Widget for Span {
let mut cursor = UiScalar::rel_min();
let mut lens = Vec::with_capacity(self.children.len());
for child in &self.children {
let len = match painter.size_hint(child, axis) {
let mut span = UiSpan::new(cursor, UiScalar::rel_max());
if self.dir.sign == Sign::Neg {
span.flip();
}
let region = UiRegion::from_axis(axis, span, UiSpan::FULL);
let len = match painter.known_len(child, axis, region) {
Some(len) => len,
None => {
let mut span = UiSpan::new(cursor, UiScalar::rel_max());
if self.dir.sign == Sign::Neg {
span.flip();
}
let region = UiRegion::from_axis(axis, span, UiSpan::FULL);
painter.place(child, region).len(axis)
}
None => painter.place(child, region).len(axis),
};
cursor.abs += len.abs + self.gap;
cursor.rel += len.rel;