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. in.
- **#16** `split/16-draw-size`, worktree `/home/bob/repos/iris-pr16`, head - **#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 methods and the size cache are gone, and `on_resize(axis)` drives the
retained path. Two review rounds answered: `Widget::draw` returns the `Size` retained path. Two review rounds answered: `Widget::draw` returns the `Size`
(no `Painter::set_size`), both `place` methods are folded back into (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. position chain.
**What the resize change taught, and why the chain moved up.** `mov` cannot **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 stretch a drawing out of a box with no relative extent. `UiScalar::within` maps
a part into such a box as a plain offset from its start, so the part's own a part's `(rel, abs)` through a matrix whose determinant is the box's own rel
fraction is gone, and `outside` asks `lerp_inv` to invert a zero-length range -- extent, so at zero extent it is singular: every fraction of that box collapses
where `div_or`'s fallback returns a rel of 0 rather than saying it cannot. The onto one stored value, and nothing recovers which one. `lerp_inv` used to return
remap then silently leaves the drawing its old size. #16 makes `OnResize::Scale` a plausible number there instead of saying so; it and `outside` now return
refuse that case, which costs a redraw of any fixed-size subtree whose box later `Option`, and `Remap` is the checked region-level operation, so a drawing that
changes length. Separating the drawn box from the offered one is what removes cannot be taken out of its box is redrawn rather than left at its old size.
the cost, so the position chain now sits directly after built-in alignment.
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 Check for a review before starting anything, and read the newest
`submitted_at` rather than the first result: `submitted_at` rather than the first result: