Skip to content

feat(edit): touch gestures to place the cursor, select words and drag handles - #2468

Open
SergioRibera wants to merge 1 commit into
marc2332:mainfrom
SergioRibera:edit-touch-gestures
Open

SergioRibera wants to merge 1 commit into
marc2332:mainfrom
SergioRibera:edit-touch-gestures

Conversation

@SergioRibera

Copy link
Copy Markdown
Contributor

Description

Adds the touch model of native text fields to freya-edit, without any UI:

  • TouchEditEvent (down, move, up, long press, handle down...) processed with UseEditable::process_touch, and TouchSelection, the touch state read with UseEditable::touch.
  • A tap places the cursor when the finger lifts, unless it moved further than TOUCH_SLOP (then it was a scroll). A double tap selects a word with touch timing and distance, a long press selects the word under the finger and dragging then extends it word by word, and the selection handles move each end.
  • LONG_PRESS_TIMEOUT and TOUCH_SLOP are public so the owner runs the timer and the checks.

It's a separate event type rather than new EditableEvent variants, so code matching on EditableEvent (like freya-code-editor) keeps compiling.

Motivation

Editing text with a finger follows the mouse model today: the cursor moves as soon as the finger goes down and dragging selects. This is the base Input (and custom editors built on use_editable) need to behave like EditText / Compose /Flutter fields.

Checklist

  • I have tested my changes.
  • I used AI assistance (e.g. ChatGPT, Copilot, etc.) to write this code.
  • I have added or updated documentation where relevant.
  • I have added or updated tests where relevant.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant