multi direction in MDCSwipeDirection.h?
Hi - Any plans to include other directions? For example ability to swipe up and down?
Thanks for this great control!
-Mez
@mez Sure, that sounds like a great idea!
Users should be able to specify which directions they want. For example, the following code would enable swiping left and up:
MDCSwipeToChooseViewOptions *options = [MDCSwipeToChooseViewOptions new];
options.supportedDirections = MDCSwipeDirectionLeft | MDCSwipeDirectionUp;
If supportedDirections is not set explicitly, left and right should be enabled by default.
Sounds like a good plan!
+1
I successfully implemented this functionality using some code from the @rFlex Pull request.
Now you can detect up down left right directions!
options.allowedDirections = MDCSwipeDirectionUp | MDCSwipeDirectionDown | MDCSwipeDirectionLeft | MDCSwipeDirectionRight;
Check the Example in my fork :+1:
For testing the Example
pod 'MDCSwipeToChoose' :git => 'https://github.com/clsource/MDCSwipeToChoose.git'
Thanks for this great library! :heart:
@clsource i actually saw this and forked yours and added some changes so YOUR changes w/ the MDCSwipeToChooseView sample view that comes w/ the project. But anyways, thanks, you saved me lots of time.
@eggie5 @clsource I appreciate the work guys, got it working thanks to @clsource fork :)
It seems my up and down directions are recognized incorrectly. If I do what I do below, a swipe up is recognized as direction down but if I do the reverse, see below it works.
Why does the following NOT work?
if (translation.y > 0.f) {
direction = MDCSwipeDirectionUp;
} else if(translation.y < 0.f) {
direction = MDCSwipeDirectionDown;
}
Instead I have to reverse it to the following in order for it to act properly:
if (translation.y < 0.f) {
direction = MDCSwipeDirectionUp;
} else if(translation.y > 0.f) {
direction = MDCSwipeDirectionDown;
}
That doesn't make sense, how can translation.y < 0.f be up?
I ended using another solution more flexible.
https://github.com/cwRichardKim/TinderSimpleSwipeCards/issues/12#issuecomment-105674387
Any updates on this feature?