Ask each child once and place its answer by re-expression
A widget draws in the box it is asked in and its answer is placed inside that box by re-expressing the drawing; nothing is drawn again in a box an answer chose. The offer machinery, whose job was to tell a measuring draw from a placing one, goes with the placing draw. A span measures each child from its cursor and moves fixed children to their slots with place_at; a share child is asked once more in its decided slot with its frame narrowed to it. A stack asks non-sizing children in the box its sizing child decided. A scroll asks its content once and moves it to the scrolled offset. A local redraw asks the retained question again and puts the answer back where the parent placed it. A symbolic length a child pinned composes through Part::Of exactly where the part is the whole box less pixels, and pins the parent's own length otherwise; dropping it let a pad reuse a drawing across a narrowed frame of the same pixel length (shrinker seeds 60, 248 and 384 at depth 5). Suite 114/114 including the two decided-box pins, fast oracle 11/11, shrinker 400 seeds at depth 5 over all fifteen cases. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
4328eac756
commit
3091fb86df
12 files changed
+353
-354
No files matched your search
+3
-3
@@ -120,15 +120,15 @@ 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, UiRegion::FULL, [Place::Within(Part::All), top])
|
||||
.widget_at(&self.probe, [None; 2], [Place::Within(Part::All), top])
|
||||
.len(Axis::X);
|
||||
let px = measured.apply_leftover().to_px(painter.px_len(Axis::X));
|
||||
|
||||
let below = Place::Within(Part::From(UiSpan::new(cut, painter.extent_len(Axis::Y))));
|
||||
let place = [Place::Within(Part::All), below];
|
||||
match px > Px::from_f32(self.threshold) {
|
||||
true => painter.widget_at(&self.wide, UiRegion::FULL, place),
|
||||
false => painter.widget_at(&self.narrow, UiRegion::FULL, place),
|
||||
true => painter.widget_at(&self.wide, [None; 2], place),
|
||||
false => painter.widget_at(&self.narrow, [None; 2], place),
|
||||
};
|
||||
Size::LEFTOVER
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user