nglviewer / ngl

WebGL protein viewer
http://nglviewer.org/ngl/
MIT License
663 stars 167 forks source link

Support pointer events instead of just mouse/touch events #902

Open luxaritas opened 2 years ago

luxaritas commented 2 years ago

I've noticed that currently, input listeners are registered specifically for mouse and touch events. Depending on what your preference for browser support is, it's relatively well supported and generally easier to work with than mouse + touch, and is generally more futureproof (eg, handling additional types of input devices).

fredludlow commented 2 years ago

Looks interesting - is there some particular issue this would fix, or functionality it would add? (I don't often use NGL with a touchscreen so can't comment with any great experience on this)

luxaritas commented 2 years ago

There aren't any significant/obvious benefits, but there's three potential points of rationale I'd consider: 1) Specifically in my case, I'm embedding NGL in another app and have to propagate input. We typically only deal with pointer events, so this would simplify our interop code. 2) The Pointer event API is much more convenient, so using it instead of mouse/touch events is liable to improve NGL's code (unifying mouse and touch handling and generally being a bit cleaner). 3) It's more futureproof against new types of input devices