Skip to content

Commit

Permalink
Further improve scroll gesture handling
Browse files Browse the repository at this point in the history
Closes #580
  • Loading branch information
LeoNatan committed Sep 26, 2024
1 parent bcc42fe commit 6cce812
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
24 changes: 21 additions & 3 deletions LNPopupController/LNPopupController/Private/LNPopupController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -843,15 +843,33 @@ - (void)_popupBarPresentationByUserPanGestureHandler_changed:(UIPanGestureRecogn
}
}

- (void)_popupBarPresentationByUserPanGestureHandler_endedOrCancelled:(UIPanGestureRecognizer*)pgr
- (BOOL)_shouldStopEndOrCancelledOnUnknownGestureRecognizerOrHorizontalScroll:(UIPanGestureRecognizer*)pgr
{
if(_dismissGestureStarted == true && pgr != _popupContentView.popupInteractionGestureRecognizer)
if(pgr == _popupContentView.popupInteractionGestureRecognizer)
{
return;
return NO;
}

UIScrollView* possibleScrollView = (id)pgr.view;
if([possibleScrollView isKindOfClass:UIScrollView.class] == NO)
{
return YES;
}

return possibleScrollView._ln_hasHorizontalContent;
}

- (void)_popupBarPresentationByUserPanGestureHandler_endedOrCancelled:(UIPanGestureRecognizer*)pgr
{
LNPopupInteractionStyle resolvedStyle = _LNPopupResolveInteractionStyleFromInteractionStyle(_containerController.popupInteractionStyle);

if(_dismissGestureStarted == true && [self _shouldStopEndOrCancelledOnUnknownGestureRecognizerOrHorizontalScroll:pgr])
{
_dismissGestureStarted = NO;

return;
}

if(_dismissGestureStarted == YES)
{
LNPopupPresentationState targetState = _stateBeforeDismissStarted;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecogni
return YES;
}

if([otherGestureRecognizer.view isKindOfClass:UIScrollView.class] && [(UIScrollView*)otherGestureRecognizer.view _ln_hasVerticalContent] == NO)
if([otherGestureRecognizer.view isKindOfClass:UIScrollView.class] && [(UIScrollView*)otherGestureRecognizer.view _ln_hasVerticalContent] == NO && [(UIScrollView*)otherGestureRecognizer.view _ln_hasHorizontalContent] == NO)
{
return YES;
}
Expand Down

0 comments on commit 6cce812

Please sign in to comment.