Touch event bug

Playing further with the HTML builds, and appear to have found another bug.

This is the entirety of a demo app:

display.newRect(512, 384, 1024, 768) function tapTest(event) print(event.x .. " x " .. event.y) end -- Do something when the screen is tapped Runtime:addEventListener('tap', tapTest)

And the config:

application = { content = { width = 768, height = 1024, scale = "letterbox", fps = 60, }, }

Compiled demo here:

https://development.qweb.co.uk/html5/test/index-debug.html

In a nutshell, clicking anywhere within the white recrangle prints out the screen x,y co-ord. Works perfectly when clicking, but on touch devices:

  • for me wherever I touch returns “-63.5 x 0.5”. I’m guessing this is something different on every device.

  • after the first touch, further touches are ignored until a mouse click. Then touch works again but always returns the same co-ord.

Hopefully enough info. Attached the test app too.

Switching from Runtime:addEventListener(’ tap’, tapTest) to Runtime:addEventListener(’ touch’, tapTest) has slightly different results:

On an HP Envy laptop with Windows 10, the touch event releases these co-ords:

-63.5 x 0.5

-63.5 x 827613632

Interestingly, subsequent touch events do trigger with this approach, but after the first touch, hovering the mouse around seems to trigger further touch events as if a button is still clicked.

I’m wondering if touch screen devices are triggering the initial click but not a release, hence when using tap clicking with the mouse works to release that event allowing a second touch to work? Either way the co-ord given makes zero sense.

On a Samsung S8 running Android 8, Runtime:addEventListener(’ touch’, tapTest) seems to actually work as expected but Runtime:addEventListener(’ tap’, tapTest) is ignored almost every time but occasionally does trigger. I’ve yet to find a pattern to this.

@richard11 thank you for the bug report and testcase.

We tested https://development.qweb.co.uk/html5/test/index-debug.html

It works on Android 8.1 (Mi A1) and laptop with Mac but we need to fix  the issue on laptop with Windows. Hoping it will be fixed soon.

Glad you’re on it @vitaly1 =).

Interesting that it’s working in Android 8.1 for you. Seems to work in 9.0 too (Pixel XL) but not 8.0 (Samsung S8). I never realised touch devices varied in technical workings so much… You’d think they just triggered the same ACPI event as a mouse click.

In 3359 was applied platform independent approach to touch events handler.  Touch events should work properly on all devices.

Excellent. I’ll rebuild asap and let you know if that’s done the trick!

Yep, seems to work in all of our test devices!

Switching from Runtime:addEventListener(’ tap’, tapTest) to Runtime:addEventListener(’ touch’, tapTest) has slightly different results:

On an HP Envy laptop with Windows 10, the touch event releases these co-ords:

-63.5 x 0.5

-63.5 x 827613632

Interestingly, subsequent touch events do trigger with this approach, but after the first touch, hovering the mouse around seems to trigger further touch events as if a button is still clicked.

I’m wondering if touch screen devices are triggering the initial click but not a release, hence when using tap clicking with the mouse works to release that event allowing a second touch to work? Either way the co-ord given makes zero sense.

On a Samsung S8 running Android 8, Runtime:addEventListener(’ touch’, tapTest) seems to actually work as expected but Runtime:addEventListener(’ tap’, tapTest) is ignored almost every time but occasionally does trigger. I’ve yet to find a pattern to this.

@richard11 thank you for the bug report and testcase.

We tested https://development.qweb.co.uk/html5/test/index-debug.html

It works on Android 8.1 (Mi A1) and laptop with Mac but we need to fix  the issue on laptop with Windows. Hoping it will be fixed soon.

Glad you’re on it @vitaly1 =).

Interesting that it’s working in Android 8.1 for you. Seems to work in 9.0 too (Pixel XL) but not 8.0 (Samsung S8). I never realised touch devices varied in technical workings so much… You’d think they just triggered the same ACPI event as a mouse click.

In 3359 was applied platform independent approach to touch events handler.  Touch events should work properly on all devices.

Excellent. I’ll rebuild asap and let you know if that’s done the trick!

Yep, seems to work in all of our test devices!