@@ -517,7 +517,10 @@ - (void)_handlePan:(UIGestureRecognizer *)sender {
517
517
[self _layoutSideContainers: NO duration: 0 ];
518
518
}
519
519
520
- if (sender.state == UIGestureRecognizerStateEnded) {
520
+ if (sender.state == UIGestureRecognizerStateChanged) {
521
+ CGFloat fullyVisibleWidth = frame.origin .x > 0 .0f ? self.leftVisibleWidth : -self.rightVisibleWidth ;
522
+ [self willPanToSidePanelVisiblePercent: (frame.origin.x / fullyVisibleWidth) duration: 0 .0f ];
523
+ } else if (sender.state == UIGestureRecognizerStateEnded) {
521
524
CGFloat deltaX = frame.origin .x - _locationBeforePan.x ;
522
525
if ([self _validateThreshold: deltaX]) {
523
526
[self _completePan: deltaX];
@@ -567,6 +570,8 @@ - (void)_undoPan {
567
570
}
568
571
}
569
572
573
+ - (void )willPanToSidePanelVisiblePercent : (CGFloat )percent duration : (CGFloat )duration {}
574
+
570
575
#pragma mark - Tap Gesture
571
576
572
577
- (void )setTapView : (UIView *)tapView {
@@ -740,6 +745,8 @@ - (void)_animateCenterPanel:(BOOL)shouldBounce completion:(void (^)(BOOL finishe
740
745
}
741
746
742
747
CGFloat duration = [self _calculatedDuration ];
748
+ CGFloat sidePanelVisiblePercent = _centerPanelRestingFrame.origin .x == 0 .0f ? 0 .0f : 1 .0f ;
749
+ [self willPanToSidePanelVisiblePercent: sidePanelVisiblePercent duration: duration];
743
750
[UIView animateWithDuration: duration delay: 0 .0f options: UIViewAnimationOptionCurveLinear|UIViewAnimationOptionLayoutSubviews animations: ^{
744
751
self.centerPanelContainer .frame = _centerPanelRestingFrame;
745
752
[self styleContainer: self .centerPanelContainer animate: YES duration: duration];
@@ -831,6 +838,7 @@ - (void)_showLeftPanel:(BOOL)animated bounce:(BOOL)shouldBounce {
831
838
if (animated) {
832
839
[self _animateCenterPanel: shouldBounce completion: nil ];
833
840
} else {
841
+ [self willPanToSidePanelVisiblePercent: 1 .0f duration: 0 .0f ];
834
842
self.centerPanelContainer .frame = _centerPanelRestingFrame;
835
843
[self styleContainer: self .centerPanelContainer animate: NO duration: 0 .0f ];
836
844
if (self.style == JASidePanelMultipleActive || self.pushesSidePanels ) {
@@ -853,6 +861,7 @@ - (void)_showRightPanel:(BOOL)animated bounce:(BOOL)shouldBounce {
853
861
if (animated) {
854
862
[self _animateCenterPanel: shouldBounce completion: nil ];
855
863
} else {
864
+ [self willPanToSidePanelVisiblePercent: 1 .0f duration: 0 .0f ];
856
865
self.centerPanelContainer .frame = _centerPanelRestingFrame;
857
866
[self styleContainer: self .centerPanelContainer animate: NO duration: 0 .0f ];
858
867
if (self.style == JASidePanelMultipleActive || self.pushesSidePanels ) {
@@ -878,6 +887,7 @@ - (void)_showCenterPanel:(BOOL)animated bounce:(BOOL)shouldBounce {
878
887
[self _unloadPanels ];
879
888
}];
880
889
} else {
890
+ [self willPanToSidePanelVisiblePercent: 0 .0f duration: 0 .0f ];
881
891
self.centerPanelContainer .frame = _centerPanelRestingFrame;
882
892
[self styleContainer: self .centerPanelContainer animate: NO duration: 0 .0f ];
883
893
if (self.style == JASidePanelMultipleActive || self.pushesSidePanels ) {
0 commit comments