diff --git a/MMDrawerController/MMDrawerController.m b/MMDrawerController/MMDrawerController.m index c70fe0c6..2795670a 100644 --- a/MMDrawerController/MMDrawerController.m +++ b/MMDrawerController/MMDrawerController.m @@ -1011,17 +1011,18 @@ -(UIViewController*)sideDrawerViewControllerForSide:(MMDrawerSide)drawerSide{ #pragma mark - UIGestureRecognizerDelegate -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{ CGPoint point = [touch locationInView:self.view]; - + BOOL shouldReceiveTouch = NO; if(self.openSide == MMDrawerSideNone){ MMOpenDrawerGestureMode possibleOpenGestureModes = [self possibleOpenGestureModesForGestureRecognizer:gestureRecognizer withTouchPoint:point]; - return ((self.openDrawerGestureModeMask & possibleOpenGestureModes)>0); + shouldReceiveTouch = ((self.openDrawerGestureModeMask & possibleOpenGestureModes)>0); } else{ MMCloseDrawerGestureMode possibleCloseGestureModes = [self possibleCloseGestureModesForGestureRecognizer:gestureRecognizer withTouchPoint:point]; - return ((self.closeDrawerGestureModeMask & possibleCloseGestureModes)>0); + shouldReceiveTouch = ((self.closeDrawerGestureModeMask & possibleCloseGestureModes)>0); } + return shouldReceiveTouch; } #pragma mark Gesture Recogizner Delegate Helpers @@ -1042,7 +1043,12 @@ -(MMCloseDrawerGestureMode)possibleCloseGestureModesForGestureRecognizer:(UIGest if([self isPointContainedWithinCenterViewContentRect:point]){ possibleCloseGestureModes |= MMCloseDrawerGestureModePanningCenterView; } - if([self isPointContainedWithinBezelRect:point]){ + if([self isPointContainedWithRightBezelRect:point] && + self.openSide == MMDrawerSideLeft){ + possibleCloseGestureModes |= MMCloseDrawerGestureModeBezelPanningCenterView; + } + if([self isPointContainedWithinLeftBezelRect:point] && + self.openSide == MMDrawerSideRight){ possibleCloseGestureModes |= MMCloseDrawerGestureModeBezelPanningCenterView; } if([self isPointContainedWithinCenterViewContentRect:point] == NO && @@ -1062,9 +1068,15 @@ -(MMOpenDrawerGestureMode)possibleOpenGestureModesForGestureRecognizer:(UIGestur if([self isPointContainedWithinCenterViewContentRect:point]){ possibleOpenGestureModes |= MMOpenDrawerGestureModePanningCenterView; } - if([self isPointContainedWithinBezelRect:point]){ + if([self isPointContainedWithinLeftBezelRect:point] && + self.leftDrawerViewController){ possibleOpenGestureModes |= MMOpenDrawerGestureModeBezelPanningCenterView; } + if([self isPointContainedWithRightBezelRect:point] && + self.rightDrawerViewController){ + possibleOpenGestureModes |= MMOpenDrawerGestureModeBezelPanningCenterView; + } + } return possibleOpenGestureModes; } @@ -1087,17 +1099,20 @@ -(BOOL)isPointContainedWithinCenterViewContentRect:(CGPoint)point{ [self isPointContainedWithinNavigationRect:point] == NO); } --(BOOL)isPointContainedWithinBezelRect:(CGPoint)point{ - CGRect leftBezelRect; +-(BOOL)isPointContainedWithinLeftBezelRect:(CGPoint)point{ + CGRect leftBezelRect = CGRectNull; CGRect tempRect; CGRectDivide(self.view.bounds, &leftBezelRect, &tempRect, MMDrawerBezelRange, CGRectMinXEdge); - - CGRect rightBezelRect; + return (CGRectContainsPoint(leftBezelRect, point) && + [self isPointContainedWithinCenterViewContentRect:point]); +} + +-(BOOL)isPointContainedWithRightBezelRect:(CGPoint)point{ + CGRect rightBezelRect = CGRectNull; + CGRect tempRect; CGRectDivide(self.view.bounds, &rightBezelRect, &tempRect, MMDrawerBezelRange, CGRectMaxXEdge); - return ((CGRectContainsPoint(leftBezelRect, point) || - CGRectContainsPoint(rightBezelRect, point)) && - [self isPointContainedWithinCenterViewContentRect:point]); + return (CGRectContainsPoint(rightBezelRect, point) && + [self isPointContainedWithinCenterViewContentRect:point]); } - @end