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
+16
-11
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
LayerId, LayoutHolds, LayoutLen, MaskIdx, MoveIdx, Place, RegionAlign, RetainedPrimitive, Size,
|
||||
TextureHandle, UiRegion, WidgetId,
|
||||
LayerId, LayoutHolds, LayoutLen, Len, MaskIdx, MoveIdx, Place, RegionAlign, RetainedPrimitive,
|
||||
Size, TextureHandle, UiRegion, WidgetId,
|
||||
};
|
||||
|
||||
/// What is kept of a widget its parent has asked about. `drawn` says whether
|
||||
@@ -20,17 +20,22 @@ pub struct ActiveData {
|
||||
/// length. Its length is the same on every ask, which is what
|
||||
/// a local redraw relies on to ask its parent's own question again.
|
||||
pub frame: UiRegion,
|
||||
/// What of its parent's extent the drawing was given, and what it was
|
||||
/// given at the parent's first ask of it -- the question a cold layout
|
||||
/// asks. A part is a length from the extent's start, so an extent that
|
||||
/// moved re-places every child by re-adding that start.
|
||||
/// The length its frame was narrowed to on each axis, as a length of
|
||||
/// its parent's frame: a declared rule, or a box its parent decided for
|
||||
/// it. `None` forwards the parent's frame whole. Kept as a length rather
|
||||
/// than a position so that every placement puts the frame back in the
|
||||
/// part it is given.
|
||||
pub narrow: [Option<Len>; 2],
|
||||
/// Where its drawing was put, as a part of its parent's box, and where
|
||||
/// it was asked. The two differ where a container asks in one place and
|
||||
/// places the answer in another -- a row measures from its cursor and
|
||||
/// puts the child in its slot. A part is a length from the box's start,
|
||||
/// so a box that moved re-places every child by re-adding that start.
|
||||
pub place: [Place; 2],
|
||||
pub offer_place: [Place; 2],
|
||||
/// The box that ask gave it, in its frame's coordinates. Kept rather
|
||||
/// than worked out again from where its parent's own box is now: a
|
||||
/// parent drawn again in the box its own answer chose gives its children
|
||||
/// boxes it never measured anything in, and the measurement this widget
|
||||
/// answered is the one its parent's layout was built on.
|
||||
/// The box it was asked in, in its frame's coordinates: the box its
|
||||
/// drawing was made in and the one its contract is about. Its drawing
|
||||
/// is placed elsewhere by re-expression, never by asking again there.
|
||||
pub offer_part: UiRegion,
|
||||
/// The measured answer and its dependencies. A hint-only dependency or
|
||||
/// a widget first encountered during placement has no measurement yet.
|
||||
|
||||
Reference in new issue
Block a user