Handle pan gesture began state in scrollView check#678
Open
zy19890102 wants to merge 4 commits intoscenee:masterfrom
Open
Handle pan gesture began state in scrollView check#678zy19890102 wants to merge 4 commits intoscenee:masterfrom
zy19890102 wants to merge 4 commits intoscenee:masterfrom
Conversation
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.
scenee
reviewed
Jan 16, 2026
| // 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( |
Owner
There was a problem hiding this comment.
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.
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.
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.