HTML5/Javascript - Is it possible to get the absolute coordinates of a touch event on a Macbook Trackpad in the browser? -
i write in browser records gestures on trackpad.
since wanted able track motion without having worry pointer leaving window, first researched problem , used mdn pointer lock api demo starting point.
but notice when using demo on macbook if lift finger , start new drag elsewhere on trackpad, ignores distance finger traveled in air, counts motion done while finger touching trackpad. consistent way trackpad used move mouse pointer in operating system in general.
but specific application, want have absolute x , y of finger on trackpad. possible build variant of demo linked above red dot corresponds absolute position of finger? e.g., if lifted finger , put down in upper left, red dot jump upper left of canvas?
i'm aware of javascript touch events api, gives absolute coordinates when used on tablet, demo not register trackpad input when run on macbook under firefox (v36) or chrome (v41).
i have read it's possible enable touch emulation in chrome, though not find checkbox under version (perhaps special developer builds have this) , reading it, seems it's more of mouse-to-touch translation i'm doubtful that emulation have specific support trackpads.
is there way getting absolute x,y coordinates of touch event on macbook trackpad possible via html/javascript?
i don't believe able trackpad work way want to. remember, trackpad supposed act mouse, it's flattened trackball. think of though finger pushes cursor around every time swipe finger , centers cursor under finger whenever press onto trackpad.
unless able map trackpad 1:1 screen, happens wacom tablet, trackpad has no correlation screen; knows mouse.
in chrome (version version 46.0.2490.71 m), can simulate touch events enabling in emulation mode:
- open dev tools f12
- either click phone icon in top-left or open better console pressing esc
- click emulation tab
- go
sensors
panel - check
emulate touch screen
Comments
Post a Comment