From 58c2ec24ba83b27cc72e94236a17919206be12c4 Mon Sep 17 00:00:00 2001 From: Jack Wu Date: Mon, 14 Apr 2014 14:47:53 -0400 Subject: [PATCH] Fix right area being draggable when only rear VC is set Disallow dragging border from the right if only rear controller is set, and vise versa when right is set but not rear. --- SWRevealViewController/SWRevealViewController.m | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/SWRevealViewController/SWRevealViewController.m b/SWRevealViewController/SWRevealViewController.m index 45d1fac..66bf64d 100755 --- a/SWRevealViewController/SWRevealViewController.m +++ b/SWRevealViewController/SWRevealViewController.m @@ -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 ;