Repository navigation
Make the sprite touchable: Grab, Throw and Poke - #49
Merged
Merged
Conversation
Three of the five verbs existed in the Engine, with tests, and nothing produced them. `WorldSnapshot.verbs` was empty on every real tick, so the sprite could be watched and not touched. This closes that half. The verbs come from polling rather than from the webview, which is what makes a drag survive. `CGEventSourceButtonState` asks the window server whether the button is down — a state query and not an event tap, so it needs no Accessibility grant, the same trade `sensing` already makes to read how long ago the last input was without reading the input. The frame loop reads it beside the cursor position it takes anyway. Routing it through the webview would have failed exactly where #6 warned. The overlay is click-through wherever the sprite is not drawn, so a drag that outran the art would stop delivering events mid-gesture. Polling does not care where the cursor is, and a held Grab now suspends the hit-test as well, so the button keeps reaching the overlay instead of the application underneath. A press stays ambiguous until it ends. Deciding on the press would snap the sprite to the cursor and drop it on every click, so a press becomes a Grab only once the hand has moved four points or held for 180ms, and a press that ends before either is a Poke. A test asserts that a click emits no Grab at any point, drift included. Poke plays `react`, which #6 left to whichever of it and #8 landed second. The Animation was in the Required Animation Set, shipped in the placeholder Character, and was selected by nothing, so a click on a wide-awake sprite did nothing at all. Reacting is not a State: it is drawn over whatever the sprite is doing and changes nothing about where it is. The hit-test now runs twice a tick against two rectangles, because the questions are about different moments. Whether a press belongs to the sprite is about the sprite the user pressed on, so it asks the one last drawn. Whether the next click should reach us is about the sprite about to be drawn, so it asks this one — a cursor arriving over the art must not spend a frame passing clicks underneath. Beyond what #6's table asks for, and easy to remove if unwanted: pressing and holding still picks the sprite up, rather than requiring movement first. And a release only throws above a threshold speed, because nobody holds a mouse perfectly still and testing for no movement at all made every release a fling. Menu and Summon are not here. #6 sequences Menu behind #18, and Summon needs the chat surface in #17. No `Verb` variant was added for Summon: nothing produces or consumes one, and an unreachable variant is the speculative generality this repo's review keeps removing. Verified against a real window server, not only in tests: a synthetic click produces one Poke and 32 frames of `react`, a drag produces a Grab on every tick it is held, and a flick produces a Throw at the speed the hand was moving. Part of #6 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Owner
Author
|
Losing the Character between displays — fixed in The cause was not the cursor conversion. Measured on this machine:
The fix
Verified
Known and left alone
|
omesser
force-pushed
the
feat/6-grab-throw-poke
branch
from
August 29, 2026 19:43
cf722d9 to
a0bbcc9
Compare
Owner
Author
|
The display work has moved out of this branch, to #56 (issue #55). This PR is back to exactly the commit that was reviewed, #56 is stacked on this branch rather than on Re-verified on the reset branch: |
This was referenced Aug 29, 2026
5 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three of the five verbs existed in the Engine, with tests, and nothing produced them.
WorldSnapshot.verbswas empty on every real tick, so the sprite could be watched and not touched.Click it, pick it up, drag it, throw it.
The verbs come from polling, not the webview
That is what makes a drag survive.
CGEventSourceButtonStateasks the window server whether the button is down. A state query, not an event tap, so no Accessibility grant — the same tradesensingalready makes to read idle time without reading input.A press stays ambiguous until it ends
Deciding on the press would snap the sprite to the cursor and drop it on every click.
A test asserts a click emits no Grab at any point, hand-drift included.
Poke plays
react#6 left this to whichever of it and #8 landed second.
reactwas in the Required Animation Set, shipped in the placeholder Character, and selected by nothing — so clicking a wide-awake sprite did nothing at all. Reacting is not a State: it draws over whatever the sprite is doing and changes nothing about where it is.Two rectangles, one tick
The hit-test now runs twice, because the questions are about different moments:
Beyond what #6's table asks — say the word and they go
Not here
Menu waits on #18 (which waits on #12, #13); Summon needs the chat surface in #17. No
Verbvariant was added for Summon — nothing produces or consumes one, and an unreachable variant is the speculative generality this repo's reviews keep removing.Verify
Then by hand, README manual checks 9–11. Exercised here against a real window server with synthetic events, not only in tests:
verbs: [Poke], 32 frames ofreactGrabon every tick held, 20 ticks ofDraggedThrow { velocity: (-1389, -1534) }— matching the dragPart of #6
🤖 Generated with Claude Code