Repository navigation
feat(ui-egui): a pen on the page picks up a pen, typing goes back (#9) - #238
Merged
Merged
Conversation
…ienTechSoftware#9) OneNote's automatic switching between drawing and typing, parts 1 and 2 of AlienTechSoftware#9: - A pen that touches the page while the caret is the pointer picks up the pen last in hand (colour, thickness and all), and that same touch draws. Only a contact that reports a force counts as a pen, so a mouse or a finger on a touch screen changes nothing. That means Windows and the web build, where the pen's pressure reaches the window. - Typing with an ink tool in hand goes back to the caret. The words land where the caret was before the pen. Shortcuts such as Ctrl+B do not switch. Stylus::landed reports a pen coming down. The press that switched the tool began before the ink layer existed, so the window asks the ink layer (inkpad::claim_press) to take it as its own. Typed text is held until the caret's line has the keyboard again, then replayed. Part 3 of AlienTechSoftware#9 (fingers pan and pinch the canvas) is not included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y4im4nvZvQHZdShop1ff8w
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.
Parts 1 and 2 of #9: OneNote's automatic switching between drawing and typing.
What changes
Only a contact that reports a force counts as a pen. A mouse or a finger on a touch screen changes nothing. In practice this works where the pen's pressure reaches the window: Windows (winit
WM_POINTER) and the web build (pointer events). On macOS and Linux winit drops tablet fields, so tools are still picked by hand there (seestylus.rs).Part 3 (fingers pan and pinch the canvas) is not included, so this PR does not close #9.
How
Stylus::landed()reports where a pen came down this frame (a touchStartwith a force).NoteCraftApp::switch_by_deviceruns before the page each frame.inkpad::claim_press→ctx.set_dragged_id). Without that, the touch that switched the tool drew nothing.replay_typing). A leftover cross-line selection is dropped so there is a text box to type into.docs/gaps.mddescribes the behaviour.Tests
a_pen_on_the_page_picks_up_the_last_pen_and_typing_puts_it_downchecks:Zgoes back to the caret and insertsZexactly where the caret was.a_pen_landing_is_seen_for_its_frame_only.cargo xtask cipasses locally.🤖 Generated with Claude Code
https://claude.ai/code/session_01Y4im4nvZvQHZdShop1ff8w