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:
1 parent
beb138632a
commit
c55be21761
8 files changed
+41
-38
No files matched your search
@@ -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, [Place::Within(Part::WHOLE), top])
|
||||
.widget_at(&self.probe, [Place::Within(Part::WHOLE), top], None)
|
||||
.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, place),
|
||||
false => painter.widget_at(&self.narrow, None, place),
|
||||
true => painter.widget_at(&self.wide, place, None),
|
||||
false => painter.widget_at(&self.narrow, place, None),
|
||||
};
|
||||
Size::LEFTOVER
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user