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

Right sidebar does goes below navbar and does not responds well to rotation #8

Open
BenjaJimenez opened this issue Aug 21, 2015 · 1 comment

Comments

@BenjaJimenez
Copy link

Hi, great work, but I've found some issues with the rightside bar:
-Seems like v1.0.2 introduced a bug in the right sidebar, as it goes now below the navbar which is kind of odd.
-Also the rightside bar does not responds well to rotation the first time is called after rotation.

@mittal12
Copy link

mittal12 commented Feb 9, 2017

please add some lines
if(self.panStartPoint.x>endPoint.x)
{
return;
}
in - (void)handlePanGesture:(UIPanGestureRecognizer *)recognizer method.

full method with the change is

  • (void)handlePanGesture:(UIPanGestureRecognizer *)recognizer {

    CGPoint location = [recognizer locationInView:self.view];
    if (CGRectContainsPoint(self.translucentView.frame, location)) {
    //return;
    }

#ifdef DEBUG
NSLog(@" Pan getsture of CDR controller");
#endif

if (!self.isCurrentPanGestureTarget) {
	return;
}

if (recognizer.state == UIGestureRecognizerStateBegan) {
	self.panStartPoint = [recognizer locationInView:self.view];
}

if (recognizer.state == UIGestureRecognizerStateChanged) {
	CGPoint currentPoint = [recognizer locationInView:self.view];
	if (!self.showFromRight) {
		[self move:self.sideBarWidth + currentPoint.x - self.panStartPoint.x];
	}
	else {
		[self move:self.sideBarWidth + self.panStartPoint.x - currentPoint.x];
	}
}

if (recognizer.state == UIGestureRecognizerStateEnded) {
	CGPoint endPoint = [recognizer locationInView:self.view];

	if (!self.showFromRight) {
		if (self.panStartPoint.x - endPoint.x < self.sideBarWidth / 3) {
			[self showAnimatedFrom:YES deltaX:endPoint.x - self.panStartPoint.x];
		}
		else {
			[self dismissAnimated:YES deltaX:endPoint.x - self.panStartPoint.x];
		}
	}
	else {

if(self.panStartPoint.x>endPoint.x)
{
return;
}

        else if (self.panStartPoint.x - endPoint.x >= self.sideBarWidth / 3) {
			[self showAnimatedFrom:YES deltaX:self.panStartPoint.x - endPoint.x];
		}
		else {
			[self dismissAnimated:YES deltaX:self.panStartPoint.x - endPoint.x];
		}
	}
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants