diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md index 1f00fcf..1232960 100644 --- a/docs/HANDOFF.md +++ b/docs/HANDOFF.md @@ -283,22 +283,19 @@ pub struct Painter<'a> { ... } -impl Part { - /// Where it lands in the coordinates `extent` is in. A `From` span is in - /// the asking widget's frame lengths, which `frame` says in the node's. - pub(crate) fn of(self, extent: UiSpan, frame: Len) -> UiSpan { - match self { - Self::All => extent, - Self::From(span) => UiSpan::new( - extent.start + span.start.within_len(frame), - extent.start + span.end.within_len(frame), - ), - Self::Of(span) => span.within(&extent), - } - } -} ``` +`Part::of` does not change: with one unit a `From` span is already a +window-unit length, so a span's cursor, `far`, `room` and slots stay as they +are and only its shares boundary reads `room.to_px(window)`. Two places +resolve through a frame: a reported fraction (`in_parent_frame`, now +`size.within_len(child_frame)`) and a declared one (`narrowed_by`, then a +`Sized` part placed by alignment). A widget's own frame reads convert once, +`Holds::at(frame_px).through(frame)`, the exact preimage of the `to_px` that +made them. `recompose_subtree` and `reposition` become one operation, since +a child's box is always `Part::of(parent box, place)`; `asked_px` is the +window. + A child's frame is `narrow.within_len(parent.frame)` where the caller or a rule narrowed it, else the parent's; a declared length also decides the box (`len` placed in the part by alignment, as `frame_and_extent` does today), @@ -329,8 +326,6 @@ What this changes in the core, and why it is not merely more code: - `in_parent` no longer maps a child's frame holds through the frame length per level: every widget holds for the window's pixels, so the holds `and` directly, at region nodes too. -- `Part::of` gains one `within_len` per `From` end. `Of` and `All` are as - they were. - `DrawInfo::frame`/`frame_abs`, `ActiveData::frame`/`frame_abs`, `local` in `Placing`, `recompose_subtree` and `asked_px` all change meaning: `frame` is a `UiVec2` length, `frame_abs` goes, a node's move entry is a