Retain child frames relative to the container extent
This commit is contained in:
1 parent
a7307d95fd
commit
c44bd198ee
6 files changed
+316
-62
No files matched your search
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user