I would like to write something in a browser that writes gestures to the trackpad.
Since I wanted to be able to track all movements without worrying about the pointer leaving the window, I first investigated this problem and used the MDN Pointer Lock API as a starting point.
But I notice when using this demo on a MacBook that if I lift my finger and start a new drag elsewhere on the trackpad, it ignores the distance that my finger moved in the air, it only considers movement while my finger is touching the trackpad. This is consistent with how the trackpad is used to move the mouse pointer in the operating system as a whole.
But for my specific application, I want to have the absolute x and y of my finger on the trackpad. Is it possible to build the demonstration option linked above, where the red dot corresponds to the absolute position of your finger? for example, if you raise your finger and then put it in the upper left corner, will the red dot always jump to the upper left of the canvas?
I know the javascript Touch Events API , which gives absolute coordinates when used on a tablet, but the demo does not register the trackpad input when working on a MacBook under Firefox (v36) or Chrome (v41).
I also read that you can enable touch emulation in Chrome, although I could not find this checkbox to do this in my version (maybe only in special builds of developers) and from reading about it, it seems to be more mouse-to-mouse translation. therefore, I doubt that this emulation will have any support for trackpads.
Is there a way to get the absolute x, y coordinates of a touch event on a MacBook trackpad using HTML / Javascript?
javascript html5 touch trackpad
uglycoyote
source share