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:
1 parent
aeb60e50f5
commit
beb138632a
8 files changed
+55
-49
No files matched your search
+3
-3
@@ -120,7 +120,7 @@ impl Widget for Branch {
|
||||
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 len = measured.apply_leftover();
|
||||
let px = painter.to_px(len, Axis::X);
|
||||
@@ -137,8 +137,8 @@ impl Widget for Branch {
|
||||
let below = Place::Within(Part::From(UiSpan::new(cut, painter.region_len(Axis::Y))));
|
||||
let place = [Place::Within(Part::WHOLE), below];
|
||||
match px > 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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user