From 1ed97af23d3d530f31e55ac2aac1d29dca14f269 Mon Sep 17 00:00:00 2001 From: stary Date: Wed, 14 Jan 2026 15:04:31 +0800 Subject: [PATCH 1/4] Handle pan gesture began state in scrollView check 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. --- Sources/Core.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/Core.swift b/Sources/Core.swift index 659ca72c..22973f09 100644 --- a/Sources/Core.swift +++ b/Sources/Core.swift @@ -731,7 +731,9 @@ class Core: NSObject, UIGestureRecognizerDelegate { if surfaceView.grabberAreaContains(initialLocation) { return false } - if let sv = scrollView, sv.panGestureRecognizer.state == .changed { + if let sv = scrollView, ( + sv.panGestureRecognizer.state == .changed || sv.panGestureRecognizer.state == .began + ) { let (contentSize, bounds, alwaysBounceHorizontal, alwaysBounceVertical) = (sv.contentSize, sv.bounds, sv.alwaysBounceHorizontal, sv.alwaysBounceVertical) From 83846847ef93b9a1cd72e5def94cc1944c25fd63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=B1?= Date: Fri, 16 Jan 2026 15:10:55 +0800 Subject: [PATCH 2/4] Fix touch handling by converting initial location 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. --- Sources/Core.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/Core.swift b/Sources/Core.swift index 22973f09..b1a2fd61 100644 --- a/Sources/Core.swift +++ b/Sources/Core.swift @@ -625,7 +625,12 @@ class Core: NSObject, UIGestureRecognizerDelegate { private func shouldScrollViewHandleTouch(_ scrollView: UIScrollView?, point: CGPoint, velocity: CGFloat) -> Bool { // 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 convertedInitialLocation = scrollView.convert( + initialLocation, + from: surfaceView + ) + guard scrollView.frame.contains(convertedInitialLocation) else { return false } // Prevents moving a panel on swipe actions using _UISwipeActionPanGestureRecognizer. // [Warning] Do not apply this to WKWebView. Since iOS 17.4, WKWebView has an additional pan From b8929ecb4d403506261fc1d1c1aa66c99b6313c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=B1?= Date: Fri, 16 Jan 2026 15:39:06 +0800 Subject: [PATCH 3/4] Fix touch handling conversion in shouldScrollViewHandleTouch 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. --- Sources/Core.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Core.swift b/Sources/Core.swift index b1a2fd61..983e851a 100644 --- a/Sources/Core.swift +++ b/Sources/Core.swift @@ -626,11 +626,11 @@ class Core: NSObject, UIGestureRecognizerDelegate { private func shouldScrollViewHandleTouch(_ scrollView: UIScrollView?, point: CGPoint, velocity: CGFloat) -> Bool { // When no scrollView, nothing to handle. guard let scrollView = scrollView else { return false } - let convertedInitialLocation = scrollView.convert( + let convertedInitialLocation = panGestureRecognizer.view?.convert( initialLocation, - from: surfaceView + to: scrollView ) - guard scrollView.frame.contains(convertedInitialLocation) else { return false } + guard let convertedInitialLocation = convertedInitialLocation, scrollView.frame.contains(convertedInitialLocation) else { return false } // Prevents moving a panel on swipe actions using _UISwipeActionPanGestureRecognizer. // [Warning] Do not apply this to WKWebView. Since iOS 17.4, WKWebView has an additional pan From 98d5016580021c9392b31d8f8d357a0f39d5893f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=B1?= Date: Fri, 16 Jan 2026 15:47:42 +0800 Subject: [PATCH 4/4] Refactor touch handling in shouldScrollViewHandleTouch 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. --- Sources/Core.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Core.swift b/Sources/Core.swift index 983e851a..a8aa8a2b 100644 --- a/Sources/Core.swift +++ b/Sources/Core.swift @@ -626,11 +626,11 @@ class Core: NSObject, UIGestureRecognizerDelegate { private func shouldScrollViewHandleTouch(_ scrollView: UIScrollView?, point: CGPoint, velocity: CGFloat) -> Bool { // When no scrollView, nothing to handle. guard let scrollView = scrollView else { return false } - let convertedInitialLocation = panGestureRecognizer.view?.convert( - initialLocation, - to: scrollView + let scrollViewFrame = surfaceView.convert( + scrollView.frame, + from: scrollView.superview ) - guard let convertedInitialLocation = convertedInitialLocation, scrollView.frame.contains(convertedInitialLocation) else { return false } + guard scrollViewFrame.contains(initialLocation) else { return false } // Prevents moving a panel on swipe actions using _UISwipeActionPanGestureRecognizer. // [Warning] Do not apply this to WKWebView. Since iOS 17.4, WKWebView has an additional pan