Skip to content

Commit d380fde

Browse files
authored
Address the grabber area detection in scroll tracking (#407)
Allows to expand the panel while touching in the grabber area initially.
1 parent 987bf79 commit d380fde

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Sources/Core.swift

+8-3
Original file line numberDiff line numberDiff line change
@@ -530,15 +530,20 @@ class Core: NSObject, UIGestureRecognizerDelegate {
530530
return false
531531
}
532532

533-
// When the current and initial point within grabber area, do scroll.
533+
// When the current point is within grabber area but the initial point is not, do scroll.
534534
if grabberAreaFrame.contains(point), !grabberAreaFrame.contains(initialLocation) {
535535
return true
536536
}
537537

538+
// When the initial point is within grabber area and the current point is out of surface, don't scroll.
539+
if grabberAreaFrame.contains(initialLocation), !surfaceView.frame.contains(point) {
540+
return false
541+
}
542+
538543
let scrollViewFrame = scrollView.convert(scrollView.bounds, to: surfaceView)
539544
guard
540-
scrollViewFrame.contains(initialLocation), // When initialLocation not in scrollView, don't scroll.
541-
!grabberAreaFrame.contains(point) // When point within grabber area, don't scroll.
545+
scrollViewFrame.contains(initialLocation), // When the initial point not in scrollView, don't scroll.
546+
!grabberAreaFrame.contains(point) // When point within grabber area, don't scroll.
542547
else {
543548
return false
544549
}

0 commit comments

Comments
 (0)