Skip to content

fix(drawbox): start freehand strokes at the exact press point - #131

Merged
akshay2211 merged 1 commit into
mainfrom
fix/pen-stroke-start-latency
Jul 27, 2026
Merged

fix(drawbox): start freehand strokes at the exact press point#131
akshay2211 merged 1 commit into
mainfrom
fix/pen-stroke-start-latency

Conversation

@akshay2211

Copy link
Copy Markdown
Owner

PEN/shape/eraser drags were driven by detectDragGestures, whose onDragStart only fires after the pointer crosses the ~8dp system touch slop and reports the slop-crossing position — so strokes began offset from and slightly after the finger-down point.

Replace it with a custom awaitEachGesture loop that begins drawing-mode gestures on the first movement with zero touch slop, seeded at the true press point, while keeping the system slop for SELECT/PAN so a click isn't misread as a drag. Starting on first move (not on down) keeps the tap handler as the sole handler for taps and avoids stray dots when a pinch begins before any drag.

Summary

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking, additive to the frozen 2.x surface)
  • Incubating API (opt-in via annotation)
  • Breaking change (would land in a future major)
  • Docs / build / CI only

Affected targets

  • Android
  • iOS
  • JVM Desktop
  • Web (WASM)
  • Web (Kotlin/JS)

Public API impact

  • No public API change
  • Additive only (new symbols, no signature changes)
  • Modifies a 2.x frozen surface — link to RFC or discussion:

Testing

  • Unit tests added / updated
  • Snapshot tests updated (Roborazzi baselines regenerated if applicable)
  • Manually verified on:

Checks

  • ./gradlew :DrawBox:spotlessCheck passes
  • ./gradlew :DrawBox:jvmTest passes
  • ./gradlew :DrawBox:dokkaGenerateHtml passes
  • CHANGELOG entry added under the correct release heading (if user-facing)
  • Migration notes added (if the JSON scene format or a frozen surface moved)

Screenshots / recording

Linked issues

PEN/shape/eraser drags were driven by detectDragGestures, whose
onDragStart only fires after the pointer crosses the ~8dp system touch
slop and reports the slop-crossing position — so strokes began offset
from and slightly after the finger-down point.

Replace it with a custom awaitEachGesture loop that begins drawing-mode
gestures on the first movement with zero touch slop, seeded at the true
press point, while keeping the system slop for SELECT/PAN so a click
isn't misread as a drag. Starting on first move (not on down) keeps the
tap handler as the sole handler for taps and avoids stray dots when a
pinch begins before any drag.
@akshay2211
akshay2211 merged commit f3b56eb into main Jul 27, 2026
3 checks passed
@akshay2211
akshay2211 deleted the fix/pen-stroke-start-latency branch July 27, 2026 15:14
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