Conversation
`WheelEventManager` synthesizes a moving pointer from a stationary cursor by accumulating wheel deltas, but only the page coordinates used the accumulator. The view relative ones subtracted a single event's delta, so they moved opposite to the page ones and never advanced across a gesture.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughWheel-event coordinate mapping now uses accumulated deltas for transformed offsets. Tests add horizontal wheel input and verify accumulated view-relative and page coordinates. ChangesWheel coordinate mapping
Priority: ⬇️ Low 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The fix is localized, consistent with existing coordinate handling, and covered by regression tests.
Review effort: Lite
Findings: None
What changed in this PR
Fixes web trackpad pan coordinates so relative x/y advance consistently with absolute coordinates.
Changes:
- Applies accumulated wheel deltas to
offsetXandoffsetY. - Adds regression coverage for trackpad coordinate consistency.
| File | Description |
|---|---|
WheelEventManager.ts |
Corrects accumulated relative wheel coordinates. |
PanGestureHandler.test.ts |
Adds trackpad coordinate regression tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Description
WheelEventManagersynthesizes a moving pointer out of a stationary cursor by accumulating wheel deltas, but only the page coordinates use the accumulator:Repro: a Pan with
enableTrackpadTwoFingerGestureon web, three trackpad frames ofdeltaY: 10fromclientY: 0,offsetY: 0.absoluteYreads 10, 20, 30 whileyreads -10, -10, -10.ypoints the wrong way and never advances for the whole gesture.translationY,velocityYandabsoluteYare fine, they come off the page coordinates.x/yandabsoluteX/absoluteYare the same point in two spaces, so they can only differ by the view's page offset. Every other producer keeps that invariant:PointerEventManager.ts:230derivesoffsetXfrom the sameclientXit writes tox,KeyboardEventManager.ts:120-129writes the view centre into both,ScrollEventManager.ts:31-34writes one value twice, andGestureHandlerButton.web.tsx:51-53computesxfromabsoluteX.WheelEventManager.ts:35-36is the only place where the two move apart.The fix applies the same accumulator to both.
onWheelis overridden only byPanGestureHandler, and the wheeloffsetX/offsetYreaches exactly one consumer,PointerTracker.relativeCoords->GestureHandler.transformNativeEvent():759.Boundary: the base stays
event.offsetX, which is relative toevent.targetrather than to the handler's view, so a wheel over a child element is still off by that child's position.PointerEventManagersidesteps that with(clientX - rect.left) / scaleX, but doing the same here costs agetBoundingClientRectper wheel event, whichScrollEventManager.mapEventexplicitly declines to pay. Left as a separate question.Test plan
yarn workspace react-native-gesture-handler test- 179 passed, was 178.The new
PanGestureHandler trackpad coordinatescase drives the realWheelEventManageroff a fake view and asserts the two spaces agree for a view at the page origin. On main it reportsx: -5, y: -10againstabsoluteX: 15, absoluteY: 30.ts-check,lint-jsandcircular-dependency-checkare clean.