Skip to content

Add two-finger pan to move the text in all directions - #234

Merged
maxistar merged 1 commit into
maxistar:masterfrom
dronov-dmitry:two-finger-pan
Aug 30, 2026
Merged

Add two-finger pan to move the text in all directions#234
maxistar merged 1 commit into
maxistar:masterfrom
dronov-dmitry:two-finger-pan

Conversation

@dronov-dmitry

@dronov-dmitry dronov-dmitry commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a two-finger pan gesture: while two fingers are pressed on the text, dragging moves the text in any direction (left/right/up/down).

How it works

  • New TwoFingerPanTouchListener attached to the editor EditText in EditorActivity.
  • When a second pointer goes down, the listener takes over the gesture and scrolls the content to follow the fingers (focal point of the two pointers).
  • Works in both layouts:
    • default (ScrollView) — vertical scroll via the ScrollView, horizontal via the EditText;
    • "simple scrolling" — both axes via the EditText.
  • Scrolling is clamped to the content bounds (panContent/clampScroll) so the text cannot be panned past its edges.
  • Single-finger behavior (cursor placement, selection, drag scrolling) is untouched.

Note: horizontal panning only applies when text is wider than the screen, i.e. when auto-wrap is turned off.

Verification

  • ./gradlew compileDebugJavaWithJavac — OK
  • ./gradlew testDebugUnitTest — OK
  • ./gradlew lint — no errors

Video

https://youtube.com/shorts/mreTjptc4fY

@maxistar maxistar left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this contribution! The implementation looks good and the CI passes. We identified a few edge cases that we can cover with tests and refine separately, but they are not blockers for merging. Great work!

@maxistar
maxistar merged commit 2c3d05c into maxistar:master Aug 30, 2026
1 check passed
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.

2 participants