Jump to content

Device class and msPointer


Recommended Posts



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 ;-)




Link to comment
Share on other sites



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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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