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

Update MMDrawerController.m #237

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
21 changes: 21 additions & 0 deletions MMDrawerController/MMDrawerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1324,9 +1324,18 @@ -(MMCloseDrawerGestureMode)possibleCloseGestureModesForGestureRecognizer:(UIGest
return possibleCloseGestureModes;
}

//-----Added by Jeffrey Start-----
bool const MMDrawerSidePanGestureFlag = true;
//-----Added by Jeffrey End-----

-(MMOpenDrawerGestureMode)possibleOpenGestureModesForGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer withTouch:(UITouch*)touch{
CGPoint point = [touch locationInView:self.childControllerContainerView];
MMOpenDrawerGestureMode possibleOpenGestureModes = MMOpenDrawerGestureModeNone;
//-----Added by Jeffrey Start-----
if(MMDrawerSidePanGestureFlag && ![self isPointContainedWithinSidesRect:point]){
return possibleOpenGestureModes;
}
//-----Added by Jeffrey End-----
if([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]){
if([self isPointContainedWithinNavigationRect:point]){
possibleOpenGestureModes |= MMOpenDrawerGestureModePanningNavigationBar;
Expand All @@ -1352,6 +1361,18 @@ -(MMOpenDrawerGestureMode)possibleOpenGestureModesForGestureRecognizer:(UIGestur
return possibleOpenGestureModes;
}

//-----Added by Jeffrey Start-----
int const MMDrawerPanGestureSideContainerWidth = 30;

-(BOOL)isPointContainedWithinSidesRect:(CGPoint)point{
CGRect centerViewContentRect = self.centerContainerView.frame;
CGRect leftSideRect = CGRectMake(centerViewContentRect.origin.x, centerViewContentRect.origin.y, MMDrawerPanGestureSideContainerWidth, centerViewContentRect.size.height);
CGRect rightSideRect = CGRectMake((centerViewContentRect.origin.x + centerViewContentRect.size.width - MMDrawerPanGestureSideContainerWidth), centerViewContentRect.origin.y, MMDrawerPanGestureSideContainerWidth, centerViewContentRect.size.height);
BOOL sideContainedFlag = (_leftDrawerViewController != nil && CGRectContainsPoint(leftSideRect, point)) || (_rightDrawerViewController != nil && CGRectContainsPoint(rightSideRect, point));
return sideContainedFlag;
}
//-----Added by Jeffrey End-----

Choose a reason for hiding this comment

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

No need to add those lines as Git Blame will properly identify the author of any given line.

Copy link
Author

Choose a reason for hiding this comment

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

These comments are only used as individual signals in my local workspace.
Thanks for your kindly reminder all the same. :)


-(BOOL)isPointContainedWithinNavigationRect:(CGPoint)point{
CGRect navigationBarRect = CGRectNull;
if([self.centerViewController isKindOfClass:[UINavigationController class]]){
Expand Down