Skip to content

Commit

Permalink
Added self.bounceOnSidePanelClose and a check to see if center panel …
Browse files Browse the repository at this point in the history
…should bounce on close.
  • Loading branch information
justinmakaila committed Mar 8, 2013
1 parent 98932fd commit 3ba092e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions JASidePanels/Source/JASidePanelController.m
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ - (void)_baseInit {
self.allowLeftOverpan = YES;
self.allowRightOverpan = YES;
self.bounceOnSidePanelOpen = YES;
self.bounceOnSidePanelClose = NO;
self.shouldDelegateAutorotateToVisiblePanel = YES;
self.allowRightSwipe = YES;
self.allowLeftSwipe = YES;
Expand Down Expand Up @@ -358,9 +359,11 @@ - (void)setCenterPanel:(UIViewController *)centerPanel {
JASidePanelState previousState = self.state;
self.state = JASidePanelCenterVisible;
[UIView animateWithDuration:0.2f animations:^{
// first move the centerPanel offscreen
CGFloat x = (previousState == JASidePanelLeftVisible) ? self.view.bounds.size.width : -self.view.bounds.size.width;
_centerPanelRestingFrame.origin.x = x;
if (self.bounceOnSidePanelClose) {
// first move the centerPanel offscreen
CGFloat x = (previousState == JASidePanelLeftVisible) ? self.view.bounds.size.width : -self.view.bounds.size.width;
_centerPanelRestingFrame.origin.x = x;
}
self.centerPanelContainer.frame = _centerPanelRestingFrame;
} completion:^(__unused BOOL finished) {
[self _swapCenter:previous with:_centerPanel];
Expand Down

0 comments on commit 3ba092e

Please sign in to comment.