Put place before the rel base, and say what a Place decides

An argument that is usually `None` goes last. So `widget_at` and `place_at`
take the place first, and `narrow_rel_base` after it.

`Place` and `Part` also now say which of the two boxes they decide, since
that is the question a caller has to answer to pick between them: `Part` is
the child's region, said as a part of the caller's own, and `Within`/`Fill`
is what becomes of the placement in it.
This commit is contained in:
iris-ai committed 2026-09-19 17:16:41 -04:00
1 parent beb138632a
commit c55be21761
8 files changed
+41 -38

No files matched your search

+2 -2
View File
@@ -14,7 +14,7 @@ impl Widget for Scroll {
let container_len = painter.px_len(self.axis);
// Asked in the whole viewport, then put at the scrolled offset.
let answer_len = painter
.widget_at(&self.inner, None, [Place::Fill(Part::WHOLE); 2])
.widget_at(&self.inner, [Place::Fill(Part::WHOLE); 2], None)
.len(self.axis);
let fixed = painter.to_px(Len::from_parts(answer_len.rel, answer_len.px), self.axis);
self.container_len = container_len;
@@ -64,9 +64,9 @@ impl Widget for Scroll {
// box, scrolled: its drawing moved there, not made again there.
painter.place_at(
&self.inner,
None,
self.axis
.pair(Place::Fill(content), Place::Fill(Part::WHOLE)),
None,
);
// What it occupies is its box, on both axes: it clips its content to
// that box, so it can neither take less of one nor honestly ask for
+2 -2
View File
@@ -36,7 +36,7 @@ impl Widget for Span {
None => {
let room = Place::Within(Part::From(along(cursor, far)));
painter
.widget_at(child, None, axis.pair(room, across))
.widget_at(child, axis.pair(room, across), None)
.len(axis)
}
};
@@ -123,7 +123,7 @@ impl Widget for Span {
let place = axis.pair(Place::Fill(Part::From(slot)), across);
let narrow =
(len.leftover > Weight::ZERO && shares).then(|| axis.pair(Some(slot.len()), None));
let used = painter.place_at(child, narrow, place).len(!axis);
let used = painter.place_at(child, place, narrow).len(!axis);
if shrinks {
// Choosing between a fixed and a relative length from the
// span's own eventual width admits multiple fixed points.
+2 -2
View File
@@ -23,7 +23,7 @@ impl Widget for Stack {
Some((i, child)) => {
painter.child_layer_at(i);
painter
.widget_at(child, None, [Place::Fill(Part::WHOLE); 2])
.widget_at(child, [Place::Fill(Part::WHOLE); 2], None)
.size()
}
None => Size::LEFTOVER,
@@ -45,7 +45,7 @@ impl Widget for Stack {
continue;
}
painter.child_layer_at(i);
painter.widget_at(child, None, place);
painter.widget_at(child, place, None);
}
size
}