WizUI / WuiDom

JavaScripted and eventy DOM
2 stars 5 forks source link

touchcancel support #54

Open tbrebant opened 8 years ago

tbrebant commented 8 years ago

What about implementing touchcancel? The mouse mapping would be useful and also make some code more homogeneous:

myDom.on('dom.touchstart', touchStart);
myDom.on('dom.touchmove', touchMove);
myDom.on('dom.touchend', touchEnd);
myDom.on('touchcancel', touchcancel); // seems to have a problem and is not working with mouse

I know it's not as easy as with other events and require a certain amount of logic, but I think it's possible, as in https://gist.github.com/Inviz/659843/85054839665e561cc0a24a878212f3ad4c661d67.

What do you think?

tbrebant commented 8 years ago

A possibly useful reminder ;)

touchstart ↔ mousedown
touchend ↔ mouseup
touchenter
touchleave ↔ mouseout
touchmove ↔ mousemove
touchcancel
ronkorving commented 8 years ago

Some thoughts for conversation tomorrow (typing from a phone, sorry)

micky2be commented 8 years ago

(In your example you mention myDom.on('touchcancel', touchcancel); but it should be myDom.on('dom.touchcancel', touchcancel);) Also I'm not really sure you understand when `touchcancel is triggered. This is not the role of WuiDom to simulate touch behavior from a mouse. Other than that I think WuiDom does already too much in therm of events.

If you want full support for both, this should be your app or a separate library do do the job.

Pointer events should be the way to go if you wanna go deeper and have more control. @polco wrote the following library if you wanna take a look: https://github.com/spur/events

polco commented 8 years ago

yeah if you want something homogeneous, pointer events are the way to go: there is a simple polyfill by the way: https://github.com/jquery/PEP