Say narrow_rel_base, and let a container pass None for it

`narrow` said what the argument did to a value it never named, so a reader
had to go and find out which value. It is `narrow_rel_base`, and the
resolved one stays the bare `rel_base` -- which is also the only one in
`Painter`, `Placing` and `LayoutHolds`, where there is nothing to tell it
apart from.

It takes `impl Into<Option<[Option<Len>; 2]>>`, so a container that does not
narrow anything writes `None` rather than `[None; 2]`, and `Span` builds the
one case that does with a `then` instead of a mutable array.

Cold layout is byte-identical to `84dad21`.
This commit is contained in:
iris-ai committed 2026-09-19 16:55:48 -04:00
1 parent aeb60e50f5
commit beb138632a
8 files changed
+55 -49

No files matched your search

+3 -3
View File
@@ -24,15 +24,15 @@ impl Widget for BranchesOnMeasurement {
let cut = Len::from_parts(Rel::ZERO, Px::from_int(40));
let top = Place::Within(Part::From(UiSpan::new(Len::ZERO, cut)));
let measured = painter
.widget_at(&self.probe, [None; 2], [Place::Within(Part::WHOLE), top])
.widget_at(&self.probe, None, [Place::Within(Part::WHOLE), top])
.len(Axis::X);
let px = painter.to_px(measured.apply_leftover(), Axis::X);
let below = Place::Within(Part::From(UiSpan::new(cut, painter.region_len(Axis::Y))));
let place = [Place::Within(Part::WHOLE), below];
match px > Px::from_f32(self.threshold) {
true => painter.widget_at(&self.wide, [None; 2], place),
false => painter.widget_at(&self.narrow, [None; 2], place),
true => painter.widget_at(&self.wide, None, place),
false => painter.widget_at(&self.narrow, None, place),
};
Size::LEFTOVER
}