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

AdditionalEvent "panleft" is fired when swiping down #1132

Open
Sherl0ck007 opened this issue Aug 21, 2017 · 7 comments
Open

AdditionalEvent "panleft" is fired when swiping down #1132

Sherl0ck007 opened this issue Aug 21, 2017 · 7 comments

Comments

@Sherl0ck007
Copy link

I have the case that there are two lines of text under the component that is supposed to be swipeable left or right. Now, if you mark the text in an upwards movement and release the mouse button in the swipeable component and swipe the component down directly after that, an additionalEvent panleft is fired. When you only swipe down the component, nothing happens like it is supposed to.

@jakewhelan
Copy link

jakewhelan commented Aug 23, 2017

I am experiencing this problem too. I have pan direction: Hammer.DIRECTION_HORIZONTAL so there should be no vertical pan detected.

This works as intended if deltaX !== 0, but when deltaX === 0 and you vertically pan, a panleft event is fired with a large deltaX. This is really hurting my hammer.js carousel implementation, we go to production soon.

Video demonstration incoming.

@jakewhelan
Copy link

jakewhelan commented Aug 23, 2017

Video demonstration: https://gyazo.com/dadccaf5375282c4eb9e619e2a0709a3

Reproduction conditions:

  • Chrome 60
  • Touch input (chrome emulator or mobile device)
  • hammertime.on("pan", foo)

@bradenfcc
Copy link

bradenfcc commented Aug 23, 2017

Same issue here (using vertical pan). If I accidentally pan left or right at start, I get a massive spike in the deltaY and then it stops detecting deltaY until next touch.

EDIT: This also appears to only be an issue on Chrome (60). Works as intended on Firefox.

@glomotion
Copy link

Yikes. I can't believe hammer's still having these problems. I suspect this issue is related to a much older one:
#1050 (comment)

@jakewhelan
Copy link

jakewhelan commented Sep 6, 2017

We've done a hack in our implementation to mitigate this issue, it's not perfect but it is better.

In your pan event handler:

hammertime.on('pan', onPan)

...

const onPan = ({ center, whatever, else, you, need }) => {
  if (center.x === 0 && center.y === 0) return
  // do whatever you need to do 
}

@nickschot
Copy link

nickschot commented Oct 28, 2017

I'm also encountering this issue (using ember-gestures which uses hammerjs). Massive spike on velocity, deltaX (in my case) on a very small vertical pan.

Thanks for the workaround @jakewhelan . Was already wondering why center was 0,0 anyway.

@Luobata
Copy link

Luobata commented Jun 25, 2018

same problem with the vertical pan. The first time on vertical pan only trigger a event panleft with center.x = -1 center.y = 0. And the second time trigger 5times most.

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

6 participants