Jump to content

Device class and msPointer


benny!
 Share

Recommended Posts

Hi,

 

the Device class by phaser (refer to line 339) sets the touch property to true on IE10, Windows7, because of the msPOinterEnabled property.




if ('ontouchstart' in document.documentElement || window.navigator.msPointerEnabled) {
      this.touch = true;
}



This confuses me since no touch events are fired. As I can read in the msdn - our lovely friends from M$, fires pointer events instead of touch events. Besides, in my case, no pointer device is attached anyway, and only normal mouse events are triggered.

 

So, my question is - is it correct to equalize pointer events with touch events? 

 

How do you guys handle pointer events?

 

Thanks for any enlightenment ;-)

 

Best,

benny!

Link to comment
Share on other sites

Add:

 

Just read here that:

 

Since MSPointer events automatically elevate to Mouse events if they aren't handled,..

 

 

So, if this is true - I recommend to wether divide into three categories (touch, mouse, msPointer) or handle msPointer more like the 'mouse' category instead of 'touch'.

 

Any thoughts?

Link to comment
Share on other sites

I updated that line of code this morning after doing some Surface testing! Here is the current dev branch version:

        if ('ontouchstart' in document.documentElement || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 1)) {            this.touch = true;        }

Even this isn't 100% bulletproof as I guess it's technically possible to have a single supported touch event on a screen, but hey it's the best we've got for now!

 

The only way to be 100% sure is to check the event.pointerType value you get from the browser event. It can be "touch", "pen" or "mouse".

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...