Skip to content

Conversation

@zy19890102
Copy link

When I scroll the trackingScrollView, it generates an offset. However, the gesture state may occur during the begin state, which causes the floatingPanel to be dragged along when I scroll the trackingScrollView, resulting in slight jitter.

zy19890102 and others added 4 commits January 14, 2026 15:04
Updated the gesture recognizer logic to also consider the .began state of the scrollView's panGestureRecognizer, in addition to .changed. This ensures gestures are handled correctly at the start of a pan.
Updated shouldScrollViewHandleTouch to convert initialLocation to the scrollView's coordinate space before checking if it is within the frame. This ensures correct touch handling when the coordinate spaces differ.
Corrects the coordinate conversion logic by converting the initial location from the pan gesture recognizer's view to the scrollView, and adds a nil check to prevent potential crashes.
Replaced conversion of initial touch location to scrollView coordinates with conversion of scrollView frame to surfaceView coordinates. This simplifies the containment check for touch handling.
// When no scrollView, nothing to handle.
guard let scrollView = scrollView, scrollView.frame.contains(initialLocation) else { return false }
guard let scrollView = scrollView else { return false }
let scrollViewFrame = surfaceView.convert(
Copy link
Owner

@scenee scenee Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! The current code implicitly assumes that the scrollView is a subview of the surfaceView. This update makes the implementation more flexible. Could you also update scrollView.frame.contains(initialLocation) on line 837 to match this change? It might be worth adding a computed property for 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