Rename rest to leftover
The length kind that asks for a part of what is left once the fixed lengths are taken is called leftover: Len::leftover(2), Len::LEFTOVER, Size::LEFTOVER, Len::leftover the field, and apply_leftover. It says what it is where "rest" reads as "the remainder of the list" as often as "the remaining space", and every agent who has touched this has reached for a third word for it. Locals called rest that meant a region or a widget are renamed with it, since the word now names something else. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9644971daf
commit
691e3eb23c
16 files changed
+98
-89
No files matched your search
@@ -37,9 +37,9 @@ impl Widget for Span {
|
||||
for (child, len) in self.children.iter().zip(&lens) {
|
||||
let mut span = UiSpan::FULL;
|
||||
span.start = start;
|
||||
if len.rest > 0.0 {
|
||||
if len.leftover > 0.0 {
|
||||
let offset = UiScalar::new(total.rel, total.px);
|
||||
let rel_end = UiScalar::rel(len.rest / total.rest);
|
||||
let rel_end = UiScalar::rel(len.leftover / total.leftover);
|
||||
let end = (UiScalar::rel_max() + start) - offset;
|
||||
start = rel_end.within(&start.to(end));
|
||||
}
|
||||
@@ -52,19 +52,19 @@ impl Widget for Span {
|
||||
}
|
||||
let used = painter.place(child, region).size().axis(!axis);
|
||||
// TODO: rel shouldn't do this, but no easy way before actually calculating pixels
|
||||
if used.rel > 0.0 || used.rest > 0.0 {
|
||||
ortho = Len::REST;
|
||||
} else if ortho.rest == 0.0 {
|
||||
if used.rel > 0.0 || used.leftover > 0.0 {
|
||||
ortho = Len::LEFTOVER;
|
||||
} else if ortho.leftover == 0.0 {
|
||||
ortho.px = ortho.px.max(used.px);
|
||||
}
|
||||
start.px += self.gap;
|
||||
}
|
||||
|
||||
// Carried whole rather than collapsed to one share: a span that sizes
|
||||
// from its children does not resolve `rest`, it passes the weight up,
|
||||
// from its children does not resolve `leftover`, it passes the weight up,
|
||||
// so nesting spans divides the same space rather than re-dividing a
|
||||
// share of it. Four `rest(1)` children under two spans under one span
|
||||
// get a quarter each, which collapsing to `rest(1)` per level does
|
||||
// share of it. Four `leftover(1)` children under two spans under one span
|
||||
// get a quarter each, which collapsing to `leftover(1)` per level does
|
||||
// not give. Resolution happens at the nearest ancestor with a length,
|
||||
// and the root always has one.
|
||||
let along = total;
|
||||
|
||||
Reference in new issue
Block a user