ColinEberhardt / VCTransitionsLibrary

A collection of iOS7 animation controllers and interaction controllers, providing flip, fold and all kinds of other transitions.
Other
4.55k stars 617 forks source link

Proper way to get the direction of pan gesture recognizer #9

Closed devangmundhra closed 10 years ago

devangmundhra commented 11 years ago

Hi,

In the HorizontalInteractionController, the direction of the UIPanGestureRecognizer is found by:

CGPoint translation = [gestureRecognizer translationInView:gestureRecognizer.view.superview];
BOOL rightToLeftSwipe = translation.x < 0;

However, I think with this way, a pan gesture will always start with a translation of 0. The correct way to get the direction would be-

CGPoint vel = [gestureRecognizer velocityInView:gestureRecognizer.view];
BOOL rightToLeftSwipe = vel.x < 0;
ColinEberhardt commented 11 years ago

Thanks a lot for this - I'll test this out and update accordingly.

devangmundhra commented 10 years ago

Closed with pull #15