Improve mobile note dragging and reliability#17
Merged
wtholliday merged 4 commits intoJul 24, 2026
Conversation
- 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.
Member
|
Thanks @txbrown ! |
Contributor
Author
|
@wtholliday thanks for reviewing this! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 usingSpatialTapGesturefor 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.