-
Notifications
You must be signed in to change notification settings - Fork 7
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
New property to force swiping in a single direction #5
base: master
Are you sure you want to change the base?
Conversation
When single-direction property is set the component can only swipe towards the edge chosen.
4b0b724
to
bab944e
Compare
… edge) Available ony when `singleDirection` property is set. Swipeable content can swipe up to its initial position (i.e. the right edge of its container when `swipeLeft` is set, the left one when `swipeRight` is set).
@leodido So basically you want the following behavior, am I right? _New behavior:_
where 0 equates false while 1 equates true _Old (or current) behavior:_
where 0 equates false while 1 equates true |
Hi @motss, not exactly. I think it is correct that this component always swipe (except when user explicitly disables it), since it's called Simply it should also be able to constrain the swiping direction (1st aspect). Indeed now there is not a way to disallow entirely the swiping in the opposite direction. This was the reason for the introduction of the In #4 I was referring to the meaning of I think this is the current behavior.
Rather the behavior I'm trying to introduce (and to complete) with this PR is. Assuming
Assuming
What do you think about? If you agree I could proceed with another commit. |
@leodido I like the idea of disallowing the element to swipeable element to left when This is my proposal and feel free to leave comments:
|
…equivalent to the default behavior (i.e. both properties missing)
|
Much appreciated. Thanks.
Worth taking a look. |
…pe in the opposite direction This commit fixes following bug. 1) swipeLeft, noOppositeSwipe are set 2) user tries to swipe towards right (resulting in a not allowed swipe movement) 3) user, without releasing the pointer, tries to swipe in the allowed direction 4) swipe does not work (also if in the allowed direction) until pointer is released This commit ensures the user can swipe back also without releasing the pointer, when the pointer comes back ans passes its first position.
Hi @motss I think here we are. What do you think? We can posticipate you good idea about slideOffset. P.S.: Probably, to fire a |
@leodido Thanks for the update.
Steps to repro this issue (Assuming on a touch device):
|
Why is this needed?
Is it because of performance issue? |
Could be useful for the user to detect when _curPos is null/0 ?
Yes.
I cannot repro the issue ... It is not clear to me, please help/explain. |
var hover = event.detail.hover(); | ||
var isOverContent = hover && Polymer.dom(this._content).deepContains(hover); | ||
|
||
if (this._swipeAllowed() && isOverContent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leodido Why hover is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@motss isOverContent is needed to avoid that the swiping works also on the underlay part, this way it only the swipeable content responds to track events.
If you do not like it by default we can make it a opt-in or opt-in behavior with a boolean property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leodido Appreciated your effort. To avoid confusion, I suggest making this change as a separate issue. Currently this PR aims to introduce new property to eliminate swipe in opposite direction. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I will move this change to another branch/PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed from current PR.
e34af9e
to
e2d30fe
Compare
Hey @motss I'm back. So, in summary what this PR misses is:
It is correct? Some considerations on this topic. |
…e direction to slideOffset
|
Hey @motss, have you seen the last commit? |
\ping @motss |
@leodido Might need some time to review. |
ping @motss |
Referring to discussion in #4 I added a new property - i.e.
single-direction
to force the swiping to work only in the same direction eventually specified byswipeLeft
orswipeRight
property.When
single-direction
property is set on<paper-swipe>
the component can only swipe towards the edge chosen.This PR does NOT introduce any breaking change.
I also added two demo blocks.