[macOS] Fix `Fling` not sending touch events and begin/end states consistently (#4395)
## Description The macOS `Fling` recognizer is a separate `NSGestureRecognizer` implementation with several gaps compared to its iOS counterpart: - it never fed `pointerTracker`, so `onTouches*` callbacks never fired; - it never dispatched BEGAN itself — on successful flicks `onBegin` only arrived at activation time (AppKit coerces the recognizer's `Possible → Changed` transition into `Began` first, which accidentally supplies it mid-drag instead of at touch-down); - failed gestures (click, slow drag, too-slow flick) produced no events at all — no `onBegin`, no `onFinalize` — breaking the begin/finalize pairing, because the fail path fires no action and there was no `reset` override to deliver the final state; - it never set the pointer type. All of this is now mirrored from the iOS recognizer: tracker calls in `mouseDown`/`mouseDragged`/`mouseUp`, a BEGAN `triggerAction` on mouse-down, a `reset` override with `triggerActionFromReset`, and `setCurrentPointerTypeToMouse`. Touch-event delivery on macOS additionally requires #4390 (pointer tracker matching `NSEvent`s); there is no code dependency between the two PRs. ## Test plan Tested in `macos-example` (with #4390 merged locally) using a v3 `useFlingGesture` with all state and touch callbacks: - fast flick: `onTouchesDown` → `onBegin` → `onTouchesMove`s → `onActivate` → `onTouchesUp` → `onDeactivate` → `onFinalize canceled=false`; - slow drag: fails via the max-duration timer, `onFinalize canceled=true` (previously: no events at all); - plain click: `onTouchesDown` → `onBegin` → `onTouchesUp` → `onFinalize canceled=true` (previously: no events at all); - repeated gestures behave identically (reset works). In the timer-fail path `onTouchesCancel` arrives after `onFinalize` — the same reset ordering the iOS recognizer produces.
M
Michał Bert committed
9c84c6d8c9d4bd0912ab4a9ae8f2ece22ca8b5bd
Parent: 769b2ec
Committed by GitHub <noreply@github.com>
on 8/7/2026, 10:09:10 AM