2

I'm implementing the following js code for adding events on a Canvas:

c.addEventListener("touchstart",function(e){console.log('touch')},true);
c.addEventListener("mousedown",function(e) {console.log("mouse")},true);

My computer is a hybrid Windows 10 tablet. On IE/EDGE, when I perform a mouse click I get 'mouse' log. On IE/EDGE, when I perform a touch on screen, I get 'mouse' log too.

However, when on IE/EDGE mobile (Windows phone) or Chrome, I get the 'touch' log when I touch the screen.

I'm convinced that shomehow IE/EDGE, when executed on a laptop, translates "touch" events to 'mouse' events.

Is there any javascript, meta-tag or any option to disable this "translation"?

Note. I'm using touch and mouse events due PIXIJS framework.

Teemu
  • 22,918
  • 7
  • 53
  • 106
Daniel Santos
  • 14,328
  • 21
  • 91
  • 174
  • if you're using pixi.js, shouldn't you handle mouse and touch events with pixi.js' Interaction Manager instead? http://pixijs.github.io/docs/PIXI.interaction.InteractionManager.html It has its own onMouseDown/onTouchStart events – securecodeninja Oct 07 '15 at 18:38
  • the problem is when I add a PIXI touch event. It does not works on desktops, even using a touchscreen. – Daniel Santos Oct 08 '15 at 19:57

2 Answers2

3

I am working on touchevents on EDGE on a laptop, you can stop the translation by changing some settings of the flags. Put about:flags in the browser URL. There under the field "Enable touch events" choose "Only on when touchscreen is detected" and under "Fire compatible mouse events in response to the tap gesture" choose "Always Off" As shown in pic

enter image description here

This will disable your automatic translation. Restart the browser and you will start getting touchevents.

akashperfect
  • 301
  • 3
  • 5
  • Is possible to programmatically disable it? – Daniel Santos May 10 '16 at 13:11
  • 1
    Even I tried but I don't think so it can programmatically be changed, because flags are very browser specific thing as they change the behavior. You can find more details regarding the same here [stackoverflow-link](http://stackoverflow.com/questions/17060363/google-chrome-how-can-i-programmatically-enable-chrome-flags-some-of-the-mod) – akashperfect May 10 '16 at 16:48
-1

Staring EdgeHTML 17, Microsoft supports Pointer Events to solve the issue:

https://stackoverflow.com/a/51159745/9598077

Hamed
  • 1,351
  • 9
  • 23