Separate measured-answer dependencies from retained drawing validity
This commit is contained in:
1 parent
c44bd198ee
commit
f860f716e6
7 files changed
+188
-356
No files matched your search
@@ -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 = DrawRegion::Extent(self.padding.region());
|
||||
let inside = self.padding.region_of(painter.placement());
|
||||
let inner = painter.widget_within(&self.inner, inside).size();
|
||||
Size {
|
||||
x: LayoutLen {
|
||||
|
||||
@@ -13,6 +13,7 @@ impl Widget for Stack {
|
||||
StackSize::Default => None,
|
||||
StackSize::Child(i) => Some(i),
|
||||
};
|
||||
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
|
||||
@@ -23,7 +24,13 @@ impl Widget for Stack {
|
||||
// drawing belongs to the layer it was made on.
|
||||
Some((i, child)) => {
|
||||
painter.child_layer_at(i);
|
||||
painter.widget(child).size()
|
||||
painter
|
||||
.widget_at(
|
||||
child,
|
||||
UiRegion::FULL,
|
||||
[Some(placement.x), Some(placement.y)],
|
||||
)
|
||||
.size()
|
||||
}
|
||||
None => Size::LEFTOVER,
|
||||
};
|
||||
@@ -35,7 +42,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, DrawRegion::Extent(UiRegion::FULL));
|
||||
painter.widget_within(child, placement);
|
||||
}
|
||||
size
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user