Pointer Events support?

CreateJS 1.5 has been updated to include the new touch code with the following two changes:

  1. In the Touch.isSupported test there is a test for:
window.PointerEvent && window.navigator.maxTouchPoints > 0

We have removed the second part (maxTouchPoints) which was reporting false on some boards. So now, those boards are considered Touch enabled. We reported the issue to the board creators via their support email.

  1. We switched to pointer event priority as the boards were also not recognizing
'ontouchstart' in window

Possibly we could have replaced this test with:

typeof window.TouchEvent !== 'undefined'

But in the end, the consensus was to solve it by testing for pointer events first rather than touch events. Pointer events were new when CreateJS was made so I think they may have hesitated to do this.

CONCLUSION

We will see how it goes for the next while and then consider updating older versions of CreateJS. And providing the change to the CreateJS GitHub.

Thanks @Chris_S and @Ferudun for the work on this. And others for the testing. Please keep testing

https://zimjs.com/drag3.html

on touch screens and let us know if you do and the result.

Thanks!

image

3 Likes

I'm going to BETT in London this week. I'll ask all the board manufacturers there if I can test the page. It's the biggest event in the UK so there should be a good range. Also I've written to my the school where I used to teach to ask if I can go in and test the page there as there's 18 boards to try.

Much of what you're talking about goes above my head here... Can I just check what we need:

  1. Drag the circle
  2. A screen shot
  3. Browser and version number
  4. Board name and brand
3 Likes

Testing across a wide range of boards sounds great James, I like your thinking!

1 Like

Thank you. I can't help with the programming. I have my doubts that they'll all let me try it at BETT, but a few might.
Am I right that this is a complete change and so we need to know if all boards are happy with this version?

1 Like

It is not that much of a change on boards. All we did there was drop the maxNumTouches > 0 requirement which was for some reason not returning true on some boards - this is the what started the thread. But we are wanting to test on as many touch screens as possible to make sure that we work on all of them now.

It is a some-what big change for non-touch screens as we are now using pointer events rather than traditional mouse events.

2 Likes

@Chris_S has prepared a modernized version of CreateJS see CreateJS Modernization? that takes out older code and this greatly simplifies the touch events tests. So... maybe we should also test

https://zimjs.com/drag4.html

as well if we want to test this future createjs file.

image

2 Likes

Not sure if it is worth the bother, but got a response from Promethean.

Would a more reliable way to detect touch support be as follows?

Touch.isSupported = function() {
    return !!(('ontouchstart' in window) // iOS & Android
        || (window.MSPointerEvent && window.navigator.msMaxTouchPoints > 0) // IE10
        || (window.PointerEvent)
        || (window.navigator.maxTouchPoints > 0)); // Extra fallback
};

Check out the pull request here CreateJS Modernization by spoltop · Pull Request #1 · danzen/createjs · GitHub

It's down to:

Touch.isSupported = function() {
	return !!window.PointerEvent;
};

The more I think about this, I question whether the Touch.isSupported code is still required at all. Pointer Events don’t care whether touch is supported so why should it matter?

It depends on how this Touch handling is used, which I want to explore further but not when I should be asleep.