bp74 / StageXL

A fast and universal 2D rendering engine for HTML5 and Dart.
http://www.stagexl.org
Other
880 stars 82 forks source link

Chrome v70+ disables Touch API on "Desktop Devices" #321

Closed MurrayLS closed 2 years ago

MurrayLS commented 5 years ago

Chrome released an update that disables the touch API by default on Desktop devices.

This means that Chromebooks that have touchscreens are not able to use the touch functionality by default on the canvas.

According to discussion on the bug tracker for that feature, Edge has done a similar thing, although I don't have a touch device that can run Edge to confirm whether this affects devices such as Surfaces.

TouchEvents can still be added to the page, at which point they are effectively re-enabled as per the document above, however the method being used to check whether touch is supported in the display/stage.dart file, line 185, is returning false, so those events are not being added.

One solution would be to find an alternate feature detection method for Chrome (and possibly Edge), another would be to add support for PointerEvents per their document, and a third, dirty, solution would be to add a force-touch-events InputEventMode.

AndrewLugg commented 4 years ago

This issue has been resolved on Chromebooks and Surface devices, with the Dart 2.4 and above. But the update has broken touch listeners on iOS 9.3.5

There is a work around, you can modify lib/src/display/stage.dart, and on line 185, remove "env.isTouchEventSupported" so that all devices get the touch listeners. It isn't a great fix, but it means that old iOS devices will work.