Record the Remap contract and the measured resize cost

This commit is contained in:
iris-ai committed 2026-09-14 01:27:48 -04:00
1 parent 270fe66802
commit d373a1b05c
1 file changed
+15 -9
+15 -9
View File
@@ -9,7 +9,7 @@ Canonical `main` is **`43ce8c7`** (#12, pointer routing). Fourteen slices are
in.
- **#16** `split/16-draw-size`, worktree `/home/bob/repos/iris-pr16`, head
`984f482`. A widget sizes itself while drawing; `SizeCtx`, the `desired_*`
`53e6128`. A widget sizes itself while drawing; `SizeCtx`, the `desired_*`
methods and the size cache are gone, and `on_resize(axis)` drives the
retained path. Two review rounds answered: `Widget::draw` returns the `Size`
(no `Painter::set_size`), both `place` methods are folded back into
@@ -33,14 +33,20 @@ readers of the axes that moved. Offered on #16 as its own slice, ahead of the
position chain.
**What the resize change taught, and why the chain moved up.** `mov` cannot
stretch a drawing out of a box with no relative extent: `UiScalar::within` puts
a part into such a box as a plain offset from its start, so the part's own
fraction is gone, and `outside` asks `lerp_inv` to invert a zero-length range --
where `div_or`'s fallback returns a rel of 0 rather than saying it cannot. The
remap then silently leaves the drawing its old size. #16 makes `OnResize::Scale`
refuse that case, which costs a redraw of any fixed-size subtree whose box later
changes length. Separating the drawn box from the offered one is what removes
the cost, so the position chain now sits directly after built-in alignment.
stretch a drawing out of a box with no relative extent. `UiScalar::within` maps
a part's `(rel, abs)` through a matrix whose determinant is the box's own rel
extent, so at zero extent it is singular: every fraction of that box collapses
onto one stored value, and nothing recovers which one. `lerp_inv` used to return
a plausible number there instead of saying so; it and `outside` now return
`Option`, and `Remap` is the checked region-level operation, so a drawing that
cannot be taken out of its box is redrawn rather than left at its old size.
Counted draws on a resize, against the old wipe-everything: 101 widgets of
padded rows went 101 -> 0, `tabs` 73 -> 0, and the `text` example 49 -> 48. The
last is the shape that does not benefit -- both paragraphs rewrap to a different
height and the relayout runs to the root. Holding each part's own region against
its box and resolving late is what removes those, so the position chain now sits
directly after built-in alignment.
Check for a review before starting anything, and read the newest
`submitted_at` rather than the first result: