-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Use Hammer for touch ONLY, not mouse #1048
Comments
if ('ontouchstart' in window) {
// do what ever you want with hammer?
} |
Doesn't work. You have a touchscreen laptop (now very common. Windows 10 is designed around it!). It can do both touch and click. Hammer is still interfering with clicks, making them do unwanted things. This doesn't solve the problem. |
What I found easiest was to ignore mouse events by checking the For example function (event) {
if (event.pointerType === 'touch') {
// handle the touch event
}
} Edit: It looks like you may need to monitor issue #547. I have not noticed a problem but now I will look more closely. |
Thanks. Yeah I ended up doing something like that (actually checking Still it would be make it clearer if this was part of the API, maybe initializing a recognizer with e.g. new Hammer.Tap({
event: "doubletap",
taps: 2,
pointerType: Hammer.POINTER_TOUCH
}); with the option to instead pass POINTER_MOUSE or POINTER_ALL, or whatever other pointers come along (POINTER_DUCK_HUNT_LIGHT_GUN?) |
I don't want Hammer doing anything with my mouse events. They're handled separately. No, I don't want to call preventDefault or stopPropagation() on them - I want it to get completely out of the way!
How do I set up hammer to do this?
Note I'm really not interested in writing an special handling to dance around Hammer (I included Hammer in the first place to get AWAY from kludge-y event juggling). It should just mind its own business and leave my mouse events alone, and there should be an option for this.
The text was updated successfully, but these errors were encountered: