MDCSwipeToChoose icon indicating copy to clipboard operation
MDCSwipeToChoose copied to clipboard

multi direction in MDCSwipeDirection.h?

Open mez opened this issue 11 years ago • 9 comments

Hi - Any plans to include other directions? For example ability to swipe up and down?

Thanks for this great control!

-Mez

mez avatar May 15 '14 14:05 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.

modocache avatar May 15 '14 14:05 modocache

Sounds like a good plan!

mez avatar May 19 '14 06:05 mez

+1

eggie5 avatar Oct 02 '14 22:10 eggie5

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 avatar Oct 03 '14 21:10 clsource

@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 avatar Oct 04 '14 01:10 eggie5

@eggie5 @clsource I appreciate the work guys, got it working thanks to @clsource fork :)

acegreen avatar Jun 07 '15 21:06 acegreen

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?

acegreen avatar Jun 15 '15 10:06 acegreen

I ended using another solution more flexible.

https://github.com/cwRichardKim/TinderSimpleSwipeCards/issues/12#issuecomment-105674387

clsource avatar Jun 15 '15 18:06 clsource

Any updates on this feature?

RishabhTayal avatar Oct 19 '15 15:10 RishabhTayal