Skip to content

Commit 6dc2fa9

Browse files
committed
Fixed CCScrollView pan gesture recognizer bug (regression).
1 parent 3df59dc commit 6dc2fa9

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

cocos2d-ui/CCScrollView.m

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,6 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecogni
751751
return (otherGestureRecognizer == _panRecognizer || otherGestureRecognizer == _tapRecognizer);
752752
}
753753

754-
#elif __CC_PLATFORM_ANDROID
755754

756755
- (void) onEnterTransitionDidFinish
757756
{
@@ -776,11 +775,9 @@ - (void) onEnterTransitionDidFinish
776775
[super onEnterTransitionDidFinish];
777776
}
778777

779-
780-
781778
- (void) onExitTransitionDidStart
782779
{
783-
#if __CC_PLATFORM_IOS
780+
784781
// Remove recognizers from view
785782
UIView* view = [CCDirector sharedDirector].view;
786783

@@ -789,20 +786,35 @@ - (void) onExitTransitionDidStart
789786
[recognizers removeObject:_tapRecognizer];
790787

791788
view.gestureRecognizers = recognizers;
789+
790+
[super onExitTransitionDidStart];
791+
}
792+
792793
#elif __CC_PLATFORM_ANDROID
794+
795+
- (void) onEnterTransitionDidFinish
796+
{
797+
dispatch_async(dispatch_get_main_queue(), ^{
798+
if(_detector)
799+
{
800+
[[[CCDirector sharedDirector] view] addGestureDetector:_detector];
801+
}
802+
});
803+
[super onEnterTransitionDidFinish];
804+
}
805+
806+
- (void) onExitTransitionDidStart
807+
{
793808
dispatch_async(dispatch_get_main_queue(), ^{
794809
if(_detector)
795810
{
796811
[[[CCDirector sharedDirector] view] removeGestureDetector:_detector];
797812
}
798813
});
799-
#endif
800814

801815
[super onExitTransitionDidStart];
802816
}
803817

804-
805-
806818
- (CCTouchPhase)handleGestureEvent:(AndroidMotionEvent *)start end:(AndroidMotionEvent *)end
807819
{
808820
CCTouchPhase phase = CCTouchPhaseStationary;

0 commit comments

Comments
 (0)