jerrybendy / vue-touch-events

Support simple touch events (tap / swipe / touch hold)
MIT License
537 stars 51 forks source link

Feature request: dbltap event #64

Open nolimitdev opened 4 years ago

nolimitdev commented 4 years ago

Event dbltab should be great alternative to native dblclick. Why? Because of native dblclick does not work on iOS. Double tab speed tolerance in ms would be fine to be configurable.

jerrybendy commented 4 years ago

Hi @nolimitdev ,

I don't think it's a good idea to support dbltap. Why we use an alternative tap event instead of click? On touch screen devices, when you tap on the screen, the browser doesn't know what you actually want to do, click or dblclick? So that the browser has to wait 300ms to ensure this is a click or a dblclick. This causes a bad user experience and the tap event is focused on solve this issue.

Back to your feature request, if we support dbltap, how could we resolve the conflict between tap and dlbtap?

nolimitdev commented 4 years ago

I will reply with question. On desktop browser with mouse how is natively solved difference between click and dblclick? It works well in practice. E.g tap can work normally without change but when there is only dbltab I think there is no problem when user do not use tap. When used both tab and dbltap, only in this case apply needed ms delay to ensure it is dbltap or tap.

jerrybendy commented 4 years ago

Yes you are right. I tried this on Chrome, and when bind click and dblclick at same time and double click it, it will trigger 2 clicks and 1 dblclick. The best way to resolve this conflict is do not resolve it 😀

I will consider how to reliaze it. Thanks for your advice.

nolimitdev commented 4 years ago

I agree that no conflict resolving is needed. When user use just dbltab, no problem. In my case Im now using v-on:click and v-on:dblclick and each does something and I never mind that clicks are fired within one dblclick (it is desirable in my case). But dblclick is not supporteted on iOS and by googling users complain about it for long years and have to use different hacks to bypass it. It will be great vue-touch-events solve this shame of Apple.

Btw anyone can simple solve conflict v-on:click/v-on:dblclick or v-touch:tap/v-touch:dbltap by yourself... apply timeout before run click/tab callback, when fired dblclick/dbltap clear timeout and fire just dblclick/dbltap callback. But in my case firing all events is desirable.

jerrybendy commented 4 years ago

iOS uses dblclick to zoom in and zoom out. Maybe this is the reason why iOS doesn't support dblclick.

euan-smith commented 3 years ago

Came here looking for exactly the same feature - I'm implementing a pan/zoom control on an image and want to exactly reproduce the double-tap to zoom in/out which people generally expect, so in this case I will just ignore single tap events so no problem both being fired. I'll work around it, but it would be really nice to have.

I do understand the problem with the delay - this is what the fast-click library was working around, but I think that delay is now gone from browsers (see here) Just firing both and letting the page deal with it is definately the right solution.