Skip to content

Improve mobile note dragging and reliability#17

Merged
wtholliday merged 4 commits into
AudioKit:mainfrom
txbrown:fix/mobile-note-interaction-v2
Jul 24, 2026
Merged

Improve mobile note dragging and reliability#17
wtholliday merged 4 commits into
AudioKit:mainfrom
txbrown:fix/mobile-note-interaction-v2

Conversation

@txbrown

@txbrown txbrown commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Dragging or resizing notes on mobile/touch devices is unreliable at the moment — a note drag updates the bound model on every gesture change instead of once when the drag ends, so a single gesture produces many intermediate model updates instead of one, and the tap-to-add-note gesture can miss taps.

Reworking note interaction to commit as a single change per gesture (via @GestureState + onEnded) and using SpatialTapGesture for adding notes makes dragging and tapping reliable on touch devices. The resize handle length is also now configurable (and clamped to half the note's length), so it scales sensibly at any zoom level.

txbrown added 4 commits July 1, 2026 22:22
- Note move drags now write the model only on gesture end. Previously every
  finger-move event wrote through the binding, which for host apps meant a
  full state round-trip per touch sample - on slower devices this caused
  frame drops mid-gesture and random tap/drag/scroll misclassification.
- Add-note now uses SpatialTapGesture instead of the
  TapGesture().sequenced(before: DragGesture) hack, which silently failed
  when the finger drifted. Requires iOS 16 / macOS 13.
- Note drag minimumDistance raised 2 -> 8 so tap-to-delete with slight
  finger movement is no longer misread as a micro-drag.
- Note views use a single root ZStack with an always-present, opacity
  controlled drag preview, keeping a constant view count per ForEach
  element (previously any note change re-evaluated every note body).
Keeps a grabbable move area on short notes when the host app requests a
large (finger-sized) handle.
@wtholliday
wtholliday merged commit 9b71fa6 into AudioKit:main Jul 24, 2026
1 check passed
@wtholliday

Copy link
Copy Markdown
Member

Thanks @txbrown !

@txbrown

txbrown commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@wtholliday thanks for reviewing this!

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