Comments (1)
I modified the plugin to resolve the following issues:
-
prevent spurious swipe events when double-tap is detected. This prevent spurious swipe events when people use the one-finger "double-tap + drag" zoom feature on Firefox.
-
prevent spurious swipe events when multi-finger gestures are detected. This prevents spurious swipe events when people do zoom-in / zoom-out gestures that could otherwise trigger spurious swipe events.
-
prevent spurious swipe when people scroll the window by a motion that is not completely vertical (or horizontal for horizontally scrolling window), useful for Chrome.
-
added an optional trace/log function (quite useful for remote debugging)
-
added config flags to support passive handler, returned value etc.
-
fixed a bug: swipeleft/swiperight should occur if abs(dx) >= threshold AND abs(dx) > abs(dy) -- the second part of the condition was missing from the code, sometimes causing swipeleft/swiperight in case where swipeup/swipedown should have occurred.
All this have been tested on Chrome, Firefox, Opera and Safari mobile browsers.
I still have a problem: On Firefox mobile (android), touch events are not sent to the handler if "some" scrolling happens when you swipe, even if you swipe mostly right/left. No such problem with Chrome (on Chrome, events are always sent to the handler, whether they cause a scroll or not - we just need to prevent spurious events when a scroll occurred, which we have implemented).
For FF. It is possible to disable default handling, but in that case scrolling does not happen at all, which is an issue in sites that require vertical scroll support and swipe right/left at the same time (like my site). It may be possible to disable default handling and still send the events for the default handling AFTER they have been processed by the plugin. I have not yet managed to do that... Maybe something like what is described there: https://stackoverflow.com/questions/7610871/how-to-trigger-an-event-after-using-event-preventdefault
I can provide you my code, if you are interested to update your plugin. I feel it is significant improvement for usability, especially with the prevention of spurious events in case of double tab, multi-finger gesture, and gesture causing scroll (on Chrome).
It is the one I currently on my photo website with swiping photos in an album. let me know of the best way to provide the updated code.
from detect_swipe.
Related Issues (9)
- Why does this plugin always prevent the default action? HOT 2
- Prevent default causing page scrolling lock HOT 1
- "Up" and "down" directions reversed HOT 1
- NPM? HOT 2
- Problem with pinch / zoom gestures HOT 2
- Propagate touch events to underlying layers (under the layer that captures the swipe events) so that buttons and links still work? HOT 2
- detect_swipe prevents Firefox from scrolling page vertically when vertical swiping HOT 2
- Vertical Scrolling not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from detect_swipe.