Handle touch events in text editor - #3442
Open
eliotbo wants to merge 1 commit into
Open
Conversation
Mirror the left-mouse-button arms for touch input, so a finger or pen can focus a text editor, place the caret, drag-select, and unfocus by tapping outside — none of which worked on touch screens before. Co-Authored-By: Claude Code Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UadsnP3Wd2fvzeUzh2oWFx
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.
Adds an
Event::Touchgroup toEditor::updateincore/src/text/editor.rs, mirroring the existing left-mouse-button arms:FingerPressedbehaves like a left-button press (focus, caret placement viamouse::Click, multi-click detection),FingerMovedwhile pressed drags the selection,FingerLifted/FingerLostrelease, and a tap outside the bounds unfocuses.This makes
text_editorusable on touch screens; previously a finger or pen could not even focus it. The implementation relies on the runtime keeping the virtual mouse cursor at the touch position (as other touch-aware widgets do), socursor.position_in(bounds)is valid in the touch arms.Battle-tested: this is the upstreamed version of a patch we've shipped in a stylus-driven audiology app on Windows tablets.
Fixes #3441.
🤖 Generated with Claude Code
https://claude.ai/code/session_01UadsnP3Wd2fvzeUzh2oWFx