luster-io / impulse

Dynamic Physics Interactions for the Mobile Web
http://impulse.luster.io
MIT License
1.59k stars 74 forks source link

PointerEvents support #11

Open pukhalski opened 10 years ago

pukhalski commented 10 years ago

Team, do you plan to add PointerEvents support for WP8/WP8.1?

I can help with that if this issue has no assignee yet.

xcoderzach commented 10 years ago

We didn't have plans, but it looks interesting. How do you see them working? Would they replace touch and mouse events only on Windows Phone?

pukhalski commented 10 years ago

WP till the latest 8.1b did not support touch events at all. As well as all touchable laptops still don't. So the same problem with touch delay and all the stuff around...

xcoderzach commented 10 years ago

Oh wow, I didn't realize older windows phone and tablets didn't support touch events, this sounds really important. If you'd like to build it, that would be amazing, since I only rarely have access to a windows phone or touch enabled laptop.

On Tue, Sep 2, 2014 at 1:11 PM, Ilya Pukhalski notifications@github.com wrote:

WP till the latest 8.1b did not support touch events at all. As well as all touchable laptops still don't. So the same problem with touch delay and all the stuff around...

— Reply to this email directly or view it on GitHub https://github.com/luster-io/impulse/issues/11#issuecomment-54184908.

pukhalski commented 10 years ago

I will try to help here.

Please assign it to me.

xcoderzach commented 10 years ago

I invited you to a group so I can assign it.

nolimits4web commented 10 years ago

It is should be easy to integrate them, they behave almost like mouse events:

mousedown -> MSPointerDown //on IE 10
mousedown -> pointerdown //on IE 11+

mousemove -> MSPointerMove //on IE 10
mousemove -> pointermove //on IE 11+

mouseup -> MSPointerUp //on IE 10
mouseup -> pointerup //on IE 11+

Support of prefixed event could be checked with window.navigator.msPointerEnabled (returns true) Support of none-prefixed event could be checked with window.navigator.pointerEnabled (returns true)

And the same way to get the pageX/pageY value in event listener:

something.addEventListener('pointerdown', function (e){
  var pageX = e.pageX;
  var pageY = e.pageY;
})

With this you'll get quick WP8 support.

But the big problem is that those damned MS tablets/laptops with both touch/mouse support :) They handle pointer events (for screen touches) and mouse events (for mouse clicks) at the same time, so to get full support on such devices you'll need to attach event listeners to both mouse and pointer events

xcoderzach commented 10 years ago

Ok, so I have access to a windows touch/mouse thing, I'll see if I can get something working. It sounds like it might be a really quick fix.