Skip to content

Start a new stroke when another finger takes over the drag - #27

Merged
sproctor merged 2 commits into
masterfrom
fix/single-finger
Sep 26, 2026
Merged

sproctor merged 2 commits into
masterfrom
fix/single-finger

Conversation

@sproctor

@sproctor sproctor commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Replaces #20 by @Bayram-MKININI, which was closed after I force-pushed the wrong commit to its branch. The commits are the same, rebased on master, and the first one is still credited to @Bayram-MKININI.

If a second finger or a palm is on the pad when the drawing finger lifts, the drag carries on with the second finger. Before, that drew a line across the pad from where the first finger lifted to the second one.

Now the stroke ends where the first finger lifted, and the second finger starts a new stroke where it is. The same happens if the first finger lifts before the drag starts and another finger starts it. The stroke's finger id is cleared when the drag ends or is cancelled. Moves that Android batches between frames are drawn for whichever finger is drawing.

Known gap: if the first finger moves in the same event where it lifts while another finger is down, that last bit of movement is lost. Compose's drag detector switches fingers without reporting it.

Tests: two-finger UI tests in SignaturePadGestureTest cover a finger taking over mid-stroke, a second finger lifting without moving, and a drag started by the second finger.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved multi-touch drawing behavior: strokes now end and resume at the appropriate pointer positions when fingers change during a gesture.
    • Preserved the final stroke segment when a pointer lifts without moving, and support starting a stroke with a second finger before dragging begins.

Bayram-MKININI and others added 2 commits September 26, 2026 10:05
When the stroke's finger lifts while another is down, end the stroke and
start a new one where the other finger is, instead of ignoring the rest of
the drag. Clear the stroke's pointer when the drag ends or is cancelled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: ae821961-b587-4869-aa7c-3b5ed6d5af5b

📥 Commits

Reviewing files that changed from the base of the PR and between 4f821ed and afa61ff.

📒 Files selected for processing (2)
  • signaturepad/src/commonMain/kotlin/com/seanproctor/signaturepad/SignaturePad.kt
  • signaturepad/src/jvmTest/kotlin/com/seanproctor/signaturepad/SignaturePadGestureTest.kt

Included review availability: This review used your included allowance. 6 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour.


📝 Walkthrough

Walkthrough

SignaturePad now tracks the pointer associated with an active stroke. It handles pointer changes by ending the current stroke and starting another. Three gesture tests cover pointer changes, lifts, and stroke completion.

Changes

Multi-pointer stroke handling

Layer / File(s) Summary
Pointer stroke lifecycle
signaturepad/src/commonMain/kotlin/com/seanproctor/signaturepad/SignaturePad.kt, signaturepad/src/jvmTest/kotlin/com/seanproctor/signaturepad/SignaturePadGestureTest.kt
SignaturePad tracks the active pointer and processes historical, current, and final-up positions through shared stroke handling. Tests cover pointer changes, lifts, and recorded stroke segments.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: bayram-mkinini

Merge Risk: ⚪ Minimal · up to afa61

No actionable merge-blocking defect is established in the pointer-takeover change. Merge after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: starting a new stroke when another finger takes over the drag.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@sproctor
sproctor merged commit b44533a into master Sep 26, 2026
2 checks passed
@sproctor
sproctor deleted the fix/single-finger branch October 14, 2026 18:01
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