playcanvas / engine

JavaScript game engine built on WebGL, WebGPU, WebXR and glTF
https://playcanvas.com
MIT License
9.61k stars 1.34k forks source link

Button within Scroll view element is triggered on touchscreen #5127

Open k3ch0ng opened 1 year ago

k3ch0ng commented 1 year ago

On touch screen (mobile), when you click a button in the scroll view list, drag it then let go ( finger still on top of button ) it actives the click event.

However with the mouse (desktop), its "aware" that the scroll has moved and does not activate the click event.

Can be seen in the "Dynamic UI Scroll View" example:

https://playcanvas.com/editor/scene/1680882

yaustar commented 1 year ago

It's not just scroll view specific. If you touch down on any button, move away and back on again, touch up, it triggers the click event.

The question here is if should be different behaviour if on a scroll view as I think the behaviour I mentioned above is intentional to mirror browser behaviour? @willeastcott do you remember the intended behaviour from when this was first implemented?

k3ch0ng commented 1 year ago

Not sure if this helps to explain further...

When you press the button it tints dark grey ("active"), move the a bit mouse, it goes back to light grey ("un-active"), let go of button - no click triggered. Repeat on touch screen, same thing happens, but the click is triggered.