Skip to content

Commit 3554c28

Browse files
committed
- Fixed more animation glitches
- Fixed a bug where a fast swipe could present the menu even if delegate return NO
1 parent 812f9b5 commit 3554c28

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

SlideMenu/Source/SlideNavigationController.m

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ @interface SlideNavigationController()
3636
@implementation SlideNavigationController
3737

3838
#define MENU_SLIDE_ANIMATION_DURATION .3
39-
#define MENU_QUICK_SLIDE_ANIMATION_DURATION .1
39+
#define MENU_QUICK_SLIDE_ANIMATION_DURATION .2
4040
#define MENU_IMAGE @"menu-button"
4141
#define MENU_SHADOW_RADIUS 10
4242
#define MENU_SHADOW_OPACITY 1
4343
#define MENU_DEFAULT_SLIDE_OFFSET 60
44-
#define MENU_FAST_VELOCITY_FOR_SWIPE_FOLLOW_DIRECTION 1000
44+
#define MENU_FAST_VELOCITY_FOR_SWIPE_FOLLOW_DIRECTION 1300
4545

4646
static SlideNavigationController *singletonInstance;
4747

@@ -459,12 +459,15 @@ - (void)panDetected:(UIPanGestureRecognizer *)aPanRecognizer
459459
// If the speed is high enough follow direction
460460
if (positiveVelocity >= MENU_FAST_VELOCITY_FOR_SWIPE_FOLLOW_DIRECTION)
461461
{
462+
Menu menu = (velocity.x > 0) ? MenuLeft : MenuRight;
463+
462464
// Moving Right
463465
if (velocity.x > 0)
464466
{
465467
if (currentX > 0)
466468
{
467-
[self openMenu:(velocity.x > 0) ? MenuLeft : MenuRight withCompletion:nil];
469+
if ([self shouldDisplayMenu:menu forViewController:self.visibleViewController])
470+
[self openMenu:(velocity.x > 0) ? MenuLeft : MenuRight withDuration:MENU_QUICK_SLIDE_ANIMATION_DURATION andCompletion:nil];
468471
}
469472
else
470473
{
@@ -476,12 +479,10 @@ - (void)panDetected:(UIPanGestureRecognizer *)aPanRecognizer
476479
{
477480
if (currentX > 0)
478481
{
479-
[self closeMenuWithCompletion:nil];
482+
[self closeMenuWithDuration:MENU_QUICK_SLIDE_ANIMATION_DURATION andCompletion:nil];
480483
}
481484
else
482485
{
483-
Menu menu = (velocity.x > 0) ? MenuLeft : MenuRight;
484-
485486
if ([self shouldDisplayMenu:menu forViewController:self.visibleViewController])
486487
[self openMenu:(velocity.x > 0) ? MenuLeft : MenuRight withDuration:MENU_QUICK_SLIDE_ANIMATION_DURATION andCompletion:nil];
487488
}

0 commit comments

Comments
 (0)