Skip to content

Commit

Permalink
Fix right area being draggable when only rear VC is set
Browse files Browse the repository at this point in the history
Disallow dragging border from the right if only rear controller is set, and vise versa when right is set but not rear.
  • Loading branch information
jackwu95 committed Apr 14, 2014
1 parent aea83fe commit 58c2ec2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions SWRevealViewController/SWRevealViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1079,10 +1079,14 @@ - (BOOL)_panGestureShouldBegin
UIView *recognizerView = _panGestureRecognizer.view;
CGFloat xLocation = [_panGestureRecognizer locationInView:recognizerView].x;
CGFloat width = recognizerView.bounds.size.width;

BOOL draggableBorderAllowing = (
_frontViewPosition != FrontViewPositionLeft || _draggableBorderWidth == 0.0f ||
xLocation <= _draggableBorderWidth || xLocation >= (width - _draggableBorderWidth) );

BOOL draggableBorderAllowing = ( _frontViewPosition != FrontViewPositionLeft || _draggableBorderWidth == 0.0f );
if (_rearViewController) {
draggableBorderAllowing = draggableBorderAllowing || xLocation <= _draggableBorderWidth;
}
if (_rightViewController) {
draggableBorderAllowing = draggableBorderAllowing || xLocation >= (width - _draggableBorderWidth);
}

// allow gesture only within the bounds defined by the draggableBorderWidth property
return draggableBorderAllowing ;
Expand Down

0 comments on commit 58c2ec2

Please sign in to comment.