I believe that the GLUT code had been written from the perspective that a system would exclusively either have mouse or touch support (desktop vs mobile). From a very brief read, it feels like the code could just drop the if() else() path and register to both, as long as it event.preventDefault()s the touch events when they target the canvas, so that those don't end up emulating mouse events by the browser and end up coming up twice to the application. If you're interested, feel free to post a patch for this.
2016-08-16 16:08 GMT+03:00 Floh <[email protected]>: > Not sure why the glut wrapper functions have regressed, but you could try > the emscripten HTML5 input functions which are modelled more closely after > the HTML input event model: > > https://github.com/floooh/oryol/blob/master/code/Modules/Input/emsc/ > emscInputMgr.cc#L50 > > Here's a demo that uses those, this has also touch input working on mobile > browsers: > > http://floooh.github.io/oryol/asmjs/TestInput.html > > Cheers, > -Floh. > > Am Dienstag, 16. August 2016 10:24:02 UTC+2 schrieb caiiiycuk: >> >> Hi! I use latest emscripten (incoming) and i have a trouble. My app works >> fine in FF, but on Chrome, Android, and WP10 my app doesn`t handle any >> mouse/touch events. >> Code of library_glut.js: >> var isTouchDevice = 'ontouchstart' in document.documentElement; >> >> window.addEventListener("keydown", GLUT.onKeydown, true); >> window.addEventListener("keyup", GLUT.onKeyup, true); >> if (isTouchDevice) { >> window.addEventListener("touchmove", GLUT.onMousemove, true); >> window.addEventListener("touchstart", GLUT.onMouseButtonDown, >> true); >> window.addEventListener("touchend", GLUT.onMouseButtonUp, true); >> } else { >> window.addEventListener("mousemove", GLUT.onMousemove, true); >> window.addEventListener("mousedown", GLUT.onMouseButtonDown, true); >> window.addEventListener("mouseup", GLUT.onMouseButtonUp, true); >> // IE9, Chrome, Safari, Opera >> window.addEventListener("mousewheel", GLUT.onMouseWheel, true); >> // Firefox >> window.addEventListener("DOMMouseScroll", GLUT.onMouseWheel, true); >> } >> >> Why we do not add event listeners for mouse (mouseup,...) if browser is >> support ontouchstart? For exmaple my pc is dell laptop with touchscreen. So >> in Chrome isTouchDevice is true, and no one mouse clicks work, only >> touching the screen is interpreted as click. BTW i don`t understand why >> touch events doesn`t works on Android and WP10 devices, i see that app is >> fine working but i can`t do any interaction. Any suggestions? >> >> -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
