The isEventSimulatedFromTouch function uses a heuristic that should usually work, but may not always. There's finally an API for this: UIEvent.source capabilities.firesTouchEvents. Currently Chrome only.
See this article and the spec. My polyfill does something a little different from your 'isEventSimulatedFromTouch' function, if you've found your position-based approach to be better then I should update the polyfill.
The isEventSimulatedFromTouch function uses a heuristic that should usually work, but may not always. There's finally an API for this:
UIEvent.source capabilities.firesTouchEvents
. Currently Chrome only.See this article and the spec. My polyfill does something a little different from your 'isEventSimulatedFromTouch' function, if you've found your position-based approach to be better then I should update the polyfill.