New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds allowDirection parameter #41
Conversation
This reverts commit 13844ad.
@MaddinMade I understand your point from this PR. And I agree with you that overlay should work well even if some directions are rejected. So I also want to fix the current behavior of However, I feel there is a better solution than this change. For this PR, I thought about the following:
Your point is so good but I feel this solution is not the best. |
Now, you can change the behavior of overlay by adjusting |
You can change thresholds, but you can only control vertical and horizontal. For example, you cannot allow swiping up and forbid swiping down. In addition, this currently works only limited well, because the maximum value is 1, which of course can be adjusted. I'm not as well versed in the package as you, but I couldn't think of a good way to add this functionality without another big breaking change.
In this case, the logic should actually behave the same as with
How about prioritizeDirection? |
How about a function where you are passed two directions in the correct order and have to return the one you want? |
In general, I would regulate it in some way with a function, because it allows you to distinguish between different indices. For other attributes, you can of course use the controller, since it's always about the current card anyway. |
@MaddinMade How about using a whitelist in the swipe direction? I feel it's easier to understand for users. I think the priority concept is too complex for UI library. I make a draft PR. Could you review this PR please? |
#43 is the overall better solution to this problem. |
Sorry for the commit chaos. There were problems with the first merge and I repeated that. I added the allowDirection parameter. With this you can now disallow directions independent of the allowVertical parameter. What is new here is that also the overlay can be built correctly as you can see in the following. Also you can still move the card in all directions unlike with allowVertical.
Before:
After: