Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If I have not set a rightViewController, there should not be a right bezel. #56

Merged
merged 1 commit into from
Jul 16, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 28 additions & 13 deletions MMDrawerController/MMDrawerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes in this method don't do anything functionally different than they were before. Any reason for changing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was just debugging and it was easier to see the value. Also cleaned it up to only have one return in the method.

}

#pragma mark Gesture Recogizner Delegate Helpers
Expand All @@ -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 &&
Expand All @@ -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;
}
Expand All @@ -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