Thing 2.0 cut 7b: pointer input (hit-test from placed geometry, press, drag, wheel, render reads the session) #27

Merged
eureka merged 11 commits from hands/thing2-commands-pointer into main 2026-11-29 05:16:57 +00:00
Owner

Thing 2.0 cut 7b (thing2:cut_spec:cut-commands-pointer.r2): Core::frame now routes the pointer.

  • input::hit_test reads the geometry render placed: half-open Placed::visible, reverse paint order, a modal overlay shutting out everything painted before it, and the modal's scrim as the hit when nothing inside it is under the point. It applies no scale, scroll or clip of its own. input::target climbs from the topmost node to the nearest Button, Toggle, Slider, Select or TextInput, or the scrim.
  • input::Input / Pointer own press state. Up over the pressed target presses a Button or the scrim (the overlay's dismiss) and flips a Toggle's draft-or-bound value; a Slider's down and move write Drafts (snapped from min, clamped) and up commits once wherever it lands; a cancel restores the draft the press found. Only the primary button presses. Every commit ends in Commands::activate.
  • The wheel climbs from the node under it (the modal's subtree under a modal) to the nearest scroll node that has room that way, and writes ScrollOffsets through the one clamp; at the end of travel the next scroll ancestor takes it. A Lines wheel is one cell in Cells and the theme's body size in Pixels.
  • Events are judged against the last good frame, before the frame's state is laid out.
  • Render reads a Session (drafts over bound values, busy and marked node states) through one current(). Session::EMPTY draws every existing golden byte for byte; a busy Button draws disabled and a mark draws one thing.error stroke.

Pointer and wheel are pinned in Pixels at scale 1 and 1.5 and in Cells; every test derives its points from Placed. Press, drag, cancel, modal, clip, scroll chaining and frame-ordering cases are in crates/thing-core/tests/input.rs; the session goldens are in render.rs.

Verification: cargo test --workspace --locked on Yggdrasil, 435 passed. cargo-mutants (test_workspace = true, new .cargo/mutants.toml): 154 tested, 118 caught, 22 missed, 14 unviable; after tests were added, the 21 survivors that still existed re-ran at 20 caught, 1 missed (slider_value: rect.w > 0.0 to >=, a zero-width track is never hit).

The TUI example in a pty on Yggdrasil: a click on f02's sign-in Button now draws it disabled (busy); a click on f01's restart Button mints nothing visible (its command asks for confirmation, and the dialog is a later cut).

Known: this is the first live caller of activation refusals (thing2:follow_up:activation-refusal-typed-cause): a click while a command waits on confirmation returns an ActivationRefused diagnostic whose cause is free text. Not fixed here.

🤖 Generated with Claude Code

Thing 2.0 cut 7b (`thing2:cut_spec:cut-commands-pointer.r2`): `Core::frame` now routes the pointer. - `input::hit_test` reads the geometry render placed: half-open `Placed::visible`, reverse paint order, a modal overlay shutting out everything painted before it, and the modal's scrim as the hit when nothing inside it is under the point. It applies no scale, scroll or clip of its own. `input::target` climbs from the topmost node to the nearest Button, Toggle, Slider, Select or TextInput, or the scrim. - `input::Input` / `Pointer` own press state. Up over the pressed target presses a Button or the scrim (the overlay's dismiss) and flips a Toggle's draft-or-bound value; a Slider's down and move write `Drafts` (snapped from `min`, clamped) and up commits once wherever it lands; a cancel restores the draft the press found. Only the primary button presses. Every commit ends in `Commands::activate`. - The wheel climbs from the node under it (the modal's subtree under a modal) to the nearest scroll node that has room that way, and writes `ScrollOffsets` through the one `clamp`; at the end of travel the next scroll ancestor takes it. A `Lines` wheel is one cell in Cells and the theme's body size in Pixels. - Events are judged against the last good frame, before the frame's state is laid out. - Render reads a `Session` (drafts over bound values, busy and marked node states) through one `current()`. `Session::EMPTY` draws every existing golden byte for byte; a busy Button draws disabled and a mark draws one `thing.error` stroke. Pointer and wheel are pinned in Pixels at scale 1 and 1.5 and in Cells; every test derives its points from `Placed`. Press, drag, cancel, modal, clip, scroll chaining and frame-ordering cases are in `crates/thing-core/tests/input.rs`; the session goldens are in `render.rs`. Verification: `cargo test --workspace --locked` on Yggdrasil, 435 passed. cargo-mutants (`test_workspace = true`, new `.cargo/mutants.toml`): 154 tested, 118 caught, 22 missed, 14 unviable; after tests were added, the 21 survivors that still existed re-ran at 20 caught, 1 missed (`slider_value`: `rect.w > 0.0` to `>=`, a zero-width track is never hit). The TUI example in a pty on Yggdrasil: a click on f02's sign-in Button now draws it disabled (busy); a click on f01's restart Button mints nothing visible (its command asks for confirmation, and the dialog is a later cut). Known: this is the first live caller of activation refusals (`thing2:follow_up:activation-refusal-typed-cause`): a click while a command waits on confirmation returns an `ActivationRefused` diagnostic whose cause is free text. Not fixed here. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Core::frame routes PointerDown/Move/Up/Cancel and Wheel against the last good frame: a press
activates through Commands::activate, a Slider drag writes Drafts, a wheel writes ScrollOffsets
through the one clamp, a modal's scrim dismisses and shuts out the tree beneath. Render reads a
Session (drafts over bound values, busy and marked node states); Session::EMPTY draws every
existing golden byte for byte.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pointer: the horizontal wheel test stays inside a Cells pane's travel
All checks were successful
Portable Eve contracts and browser lowering / ubuntu-latest eve-browser-lowering (pull_request) Successful in 3m42s
Portable Eve contracts and browser lowering / ubuntu-latest eve-contracts (pull_request) Successful in 3m38s
71221b13bd
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Finding nonmodal-overlay-root-swallows (thing2:verdict:cut-commands-pointer.s1). The root is the viewport or the
anchor's rect, not something drawn. A modal's scrim still catches. Tests: viewport- and node-anchored at scale 1,
1.5 and Cells, plus the wheel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Finding busy-gate-leaves-unsent-draft. Commands::refuses_change is the one gate: activate's Change path calls it
before capture::change writes the draft, and a Slider press and drag call it before the Drafts write. A refused
change writes nothing and returns the ActivationRefused diagnostic; a Button press stays silent. This supersedes
7a's order (a change written to Drafts before the busy and enabled checks), for pointer changes and for
Commands::activate alike. The 7a test that pinned it, a_completion_clears_the_drafts_it_captured_and_a_newer_edit_survives
(tests/command.rs), now pins the refusal; the Toggle second-press assertion in tests/input.rs changed with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Finding events-read-new-tree-old-geometry. Core::frame routes the frame's events first, against the last drawn
geometry and the tree bound when it was drawn, then switches surface, drains provider updates and binds. Captures
mint from what the user saw. Test: the provider unchecks a toggle in the frame the user clicks it checked; the
mint carries the unchecked value, in Pixels at 1 and 1.5 and in Cells.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Finding hit-seam-at-fractional-scale. covers() puts the point and every edge on the device grid (k times the
logical value, held to 1/1024 px) and tests half-open, so the first pixel past an edge is outside at scales 1.25,
1.5, 1.75, 2.5 and 3.0. render::device_scale is the one usable-scale rule; the wheel's copy in pointer.rs is
deleted (finding public-surface-and-scale-rule-twice, scale half). Test: first and last pixel of every leaf of
odd-width rows, corner and centre, at 1, 1.25, 1.5, 1.75, 2, 2.5 and 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Finding slider-zero-width-guard-killable. A move over a zero-wide track must leave the draft as the press wrote it
(0/0 and n/0 are not values); the rect.w >= 0.0 mutant now fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The route now runs before the switch, so the diagnostics it returns are held and joined to the notes after the
switch has pushed its own (a held resume dropped on leaving a surface is said in the same frame).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Finding public-surface-and-scale-rule-twice (surface half). hit_test, Hit and HitKind had no consumer inside the
crate and are deleted; Input, Seen and Owners are pub(crate), Pointer private, hit and pointer modules private.
The Rig tests (hit-testing, press state, the wheel, drafts) moved to src/input/tests.rs with three small doubles
(Port, Counter, Boxes), because thing-testkit's types name the library build of thing-core, not the test build.
The Core::frame tests stay in tests/input.rs. The contract documents both share are tests/support/mod.rs. The F03,
F01/F05/F06 and F04 fixtures the Rig tests loaded are replaced by documents built in tests/support (a target on a
board, the shared surfaces, a Select and a TextInput); no feature flag, no doc(hidden).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pointer tests: the seam test's scales are Pixels only; unused helper and import removed
All checks were successful
Portable Eve contracts and browser lowering / ubuntu-latest eve-browser-lowering (pull_request) Successful in 2m51s
Portable Eve contracts and browser lowering / ubuntu-latest eve-contracts (pull_request) Successful in 3m12s
bc378984c2
The first-pixel test of the hit-seam finding listed Cells beside the Pixels scales; a Cells node of a few px is
less than a cell wide, so the test is for the fractional Pixels scales (Cells edges are pinned by
a_rect_is_half_open_so_a_shared_edge_belongs_to_the_second_node). The commit that moved the pointer tests into the
crate carried the wrong list; this is the corrected final spelling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eureka merged commit 17a0008d3e into main 2026-11-29 05:16:57 +00:00
eureka deleted branch hands/thing2-commands-pointer 2026-11-29 05:16:57 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
GameCult/Thing!27
No description provided.