Skip to content
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

suggested change to "swipe" recognizer #640

Closed
annam opened this issue Aug 8, 2014 · 10 comments
Closed

suggested change to "swipe" recognizer #640

annam opened this issue Aug 8, 2014 · 10 comments

Comments

@annam
Copy link
Contributor

annam commented Aug 8, 2014

Hello,

after upgrading to hammer v2 we noticed some inconsistencies in swipe detection:

for swipe to be triggered in v2 the velocity and direction are calculated from the last interval. so if you swipe but keep your finger on screen for a few milliseconds, velocity drops and direction may even be 'none'. this wasn't the case in v1, I haven't checked the code but the swipe listener was definitely more sensitive.

we've noticed that "swipe" is commonly (expected to be) triggered even after holding the finger down for some time after a swipe interaction, and this seems to be missed in v2.

we tried to override the velocity issue by using a negative velocity value, which unfortunately forces the swipe detection to disregard velocity all together but it's something that we can live with.

however to fix the direction "none" issue (or even wrong dimension if you slightly move your finger in any other direction while holding) we had to override the attrTest and emit functions of the swipe recognizer to use the offsetDirection value instead of the direction one. unfortunately this means we'll miss any updates to the swipe recognizer unless we compare and add them to our own overrides. it would be great if you cared to integrate this into the master hammer.js!

tnx!

@runspired
Copy link
Contributor

+1

@jtangelder
Copy link
Member

Could you create a PR for these changes?

@tosca
Copy link

tosca commented Aug 14, 2014

I am so sorry to bother you, but you are the experts and I have been
working on this for 3 weeks. Before I 'punt', I would like to know if
hammer.js versoin 1/**works with multiple carousels on multiple bootstrap
nav-tabs pages. I can get multiple carousels to swipe independently on one
single page, but not on a one page tab container.
* super simple carousel
* animation between panes happens with css transitions
*/
function Carousel(element)
{ etc...

http://rickmaxwell.apphb.com/#!work

I do have hammer working on my website build, but when tabbing to another
"WORK" catagory, the images are images render 100px wide across the
screen... BUT work perfectly when you resize the browser window,
(naturally, you cannot resize phones and tablets, but if you swipe enough
times, the single img fills the screen.

Oddly, the first carousel in the WORKS catagory works perfectly, but the
tab-click to the second catagory, returns a "pane" element that is always
100px wide, initially, until you resize the screen.

Does hammer.js ver 1, support multiple carousels in separate tab-pane
containers?

I am eternally grateful.

Thank you and njoy!

Tosca Ragnini
tosca.ragnini@gmail.com
630.248.1990

http://www.toscatech.net%20 www.toscatech.net

On Tue, Aug 12, 2014 at 4:55 AM, Jorik Tangelder notifications@github.com
wrote:

Could you create a PR for these changes?


Reply to this email directly or view it on GitHub
#640 (comment).

@annam
Copy link
Contributor Author

annam commented Aug 14, 2014

Sure i'll create a PR for this next week!

@bmesing
Copy link

bmesing commented Sep 10, 2014

+1
The current implementation make swiping almost unusable: The velocity is calculated only for a certain last interval, i.e. if you slow down at the very end of your gesture (as one often does especially with a mouse), swiping will not work.

@ghost
Copy link

ghost commented Sep 11, 2014

+1

@src-code
Copy link

+1 Glad to see this addressed in PR #669, it makes it difficult to recognize aborted pans/swipes as well (eg, user swipes a carousel left, but then starts to swipe right before releasing... normally you could compare direction and offsetDirection, but a momentary hesitation causes direction == none)

@akruis
Copy link

akruis commented Oct 2, 2014

I just tried PR #669 and get much better results on iOS.

  • 1 for this PR.

p.s. and many many thanks for providing hammer.

@anitapillai
Copy link

The current implementation make swiping almost unusable on Desktops. PR #669 fixes the issue

@runspired
Copy link
Contributor

Closing in favor of #806

arschmitz pushed a commit that referenced this issue Aug 8, 2015
if after pinch/rotate, one finger touchends before the other, swipe is
incorrectly triggered because the last gesture is a single-touch
gesture. this checked for maximum pointers in gesture

Fixes #640
Ref #639
Ref #806
Closes #669
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants