Retain child frames relative to the container extent

This commit is contained in:
iris-ai committed 2026-09-17 16:40:54 -04:00
1 parent a7307d95fd
commit c44bd198ee
6 files changed
+316 -62

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@ impl Widget for Pad {
// it; where the box is bigger -- a share of a row, a rule over this
// widget -- the slack is the inner's to sit in, and forcing the near
// edge pinned it to a corner it had not asked for.
let inside = self.padding.region_of(painter.placement());
let inside = DrawRegion::Extent(self.padding.region());
let inner = painter.widget_within(&self.inner, inside).size();
Size {
x: LayoutLen {
+2 -10
View File
@@ -13,8 +13,6 @@ impl Widget for Stack {
StackSize::Default => None,
StackSize::Child(i) => Some(i),
};
// This stack's own box, which is `FULL` until its answer is known.
let placement = painter.placement();
// Whichever child sizes the stack keeps the stack's whole region as
// its own -- the stack is the length that child asked for, so taking
// the fraction of the stack's box again would take it twice -- and is
@@ -25,13 +23,7 @@ impl Widget for Stack {
// drawing belongs to the layer it was made on.
Some((i, child)) => {
painter.child_layer_at(i);
painter
.widget_at(
child,
UiRegion::FULL,
[Some(placement.x), Some(placement.y)],
)
.size()
painter.widget(child).size()
}
None => Size::LEFTOVER,
};
@@ -43,7 +35,7 @@ impl Widget for Stack {
// Every other child has the stack's own box for its region, since
// the stack is what contains it, and where it sits in one bigger
// than itself is its own business.
painter.widget_within(child, placement);
painter.widget_within(child, DrawRegion::Extent(UiRegion::FULL));
}
size
}