hammerjs / hammer.js

A javascript library for multi-touch gestures :// You can touch this
http://hammerjs.github.io
MIT License
24.12k stars 2.62k forks source link

Horizontal swipe event has utterly random direction values, including none, up, down, etc. #1299

Open php4fan opened 7 months ago

php4fan commented 7 months ago
  1. Run this on a mobile device: https://codepen.io/php4fan/pen/mdgwBdb
  2. Swipe left and right

Expected: the logged value, which is the direction property of the swipe event, should always be 2 when you swipe left and 4 when you swipe right.

Observed: the value sometimes is 1 (NONE) or even 8 (UP).

According to documentation, by default only horizontal swipe recognition is enabled. And indeed, the event does only fire when you swipe horizontally, as expected. However, the value of direction sometimes is neither left nor right, which makes no sense.