godot icon indicating copy to clipboard operation
godot copied to clipboard

Setting button to pass mouse events makes clicking difficult on Android

Open j-zeppenfeld opened this issue 1 year ago • 4 comments

Tested versions

  • Reproducible in: v4.3.beta3.official [82cedc83c]
  • Not reproducible in: v4.2.2.stable.official [15073afe3]

System information

Android, Samsung Galaxy S10e

Issue description

In order to make menus touch scrollable in Android, buttons must be set to pass mouse events. In Godot 4.2, the dead zone before the button passed motion events was big enough to allow consistent pressing of the button. In Godot 4.3, this dead zone seems to be practically 0, making clicking the button all but impossible.

Steps to reproduce

Create a simple UI with a ScrollContainer, VBoxContainer and enough Buttons to get the ScrollContainer to scroll. Set the buttons to pass mouse events (in order to make the ScrollContainer touch scrollable). Run the project on Android. While scrolling works, clicking the buttons is practically impossible.

Minimal reproduction project (MRP)

The top three buttons are set to pass mouse events and work to scroll, but are difficult to click. The bottom three buttons are set to stop mouse events and cannot be used to scroll, but can be easily clicked. In Godot 4.2, both scrolling and clicking are easily possible on the top three buttons.

exittest.zip

j-zeppenfeld avatar Aug 14 '24 21:08 j-zeppenfeld

May be related to https://github.com/godotengine/godot/issues/93612, cc @m4gr3d @Alex2782

akien-mga avatar Aug 14 '24 21:08 akien-mga

this dead zone seems to be practically 0

yes for #84138 and #84182. However, it is possible to customize Scroll Deadzone in the ScrollContainer.

image


In the next few days I will try to create PR for new default value, first I would have to check the effects on other operating systems.

https://github.com/search?q=repo%3Agodotengine%2Fgodot+scroll_deadzone&type=code

Alex2782 avatar Aug 14 '24 22:08 Alex2782

This is an interesting conflict of interest, with touch responsiveness on one side and ui usability on the other.

Manually setting the scroll dead zone of all scroll containers works fine for my project.

I would recommend adding this to known issues for the 4.3 release. I imagine there will be quite a few Android projects with unusable UI because of this change.

j-zeppenfeld avatar Aug 15 '24 08:08 j-zeppenfeld

scroll_test.zip

@j-zeppenfeld : I couldn't find any issues with deadzone = 0 on my Android devices. See video, from which deadzone value is everything ok on your device? (DPI / Scale / Size values?)

Perhaps we can somehow take the DPI / Scale / Size values into account for touchscreens.

Video: Samsung Tab S7, 12.4" display

https://github.com/user-attachments/assets/17922bf5-f198-4de6-b0a9-fc9c9fffa840

Also on my Pixel 4a, 5.8" display, DPI: 440, Scale: 1, Size: (2340, 1080) like in video 100% no scroll events triggered.


Note: There is a bug, already 6 years old. Further down in the ScrollContainer scrolling over controls does not always work, pressed should always work there 😃

Video: issue #22936

https://github.com/user-attachments/assets/8d811734-7ea8-442e-be5c-2d17a1a9712c

Alex2782 avatar Aug 17 '24 22:08 Alex2782

Deadzone=0 is definitely not usable on my Galaxy S10e (DPI 480 Scale 1 Size 2280x1080), quick taps from an experienced user are ok at deadzone=2, for less experienced users I would probably set the deadzone to at least 4, probably higher.

Here's a video of what it looks like on my device:

https://github.com/user-attachments/assets/fd081112-b0e5-45ab-bd14-ff6a80c112c8

j-zeppenfeld avatar Aug 18 '24 08:08 j-zeppenfeld

Playing with this some more, it seems that my device is especially eager to send InputEventScreenDrag.

The absolute minimum output I can achieve for as short a tap as possible always includes at least 5 events: an InputEventScreenDrag surrounded by press and release InputEventMouseButton and InputEventScreenTouch events.

j-zeppenfeld avatar Aug 18 '24 09:08 j-zeppenfeld

@j-zeppenfeld If you find time please try PR #95827, with your productive projects.

or android_debug_base_button.apk 27 MB Download https://drive.google.com/file/d/1vVCK1tUHzi6kloKjcY698CBDkDDrGv9q/view?usp=sharing

Bildschirmfoto 2024-08-20 um 23 08 10


adb logcat -s godot

Logs: on my Samsung Tab S7, pressed_tolerance = round (DPI / 50)

08-20 22:52:53.344 16666 16735 I godot   : InputEventMouseMotion, drag_from:  (846.6693, 378.7633) , is_scrolling:  true
08-20 22:52:53.344 16666 16735 I godot   : 	 drag_from:  (846.6693, 378.7633)
08-20 22:52:53.344 16666 16735 I godot   : 	 get_mouse_position:  (844.67, 380.762)
08-20 22:52:53.344 16666 16735 I godot   : 	 diff:  (-1.999207, 1.998657)
08-20 22:52:53.344 16666 16735 I godot   : 	 pressed_tolerance:  7

Alex2782 avatar Aug 20 '24 21:08 Alex2782

@j-zeppenfeld If you find time please try PR #95827, with your productive projects.

Yup, working great in both projects (my main pixel art project and your modified exit test project). Thank you!

j-zeppenfeld avatar Aug 23 '24 18:08 j-zeppenfeld

Can I desperately ask somebody to give attention to this issue

goranovs avatar Jan 11 '25 20:01 goranovs

@goranovs Is this configuration (https://github.com/godotengine/godot/issues/95532#issuecomment-2290024808) an option for you? Increase to 10.

Alex2782 avatar Jan 12 '25 00:01 Alex2782

Hi @Alex2782,

I've used 5 to make it usable again. Anything below 5 felt like there was a chance to miss the press, but 10 seems to be the better value—the scrolling feels more natural, and the button press works fine.

Thank you!

goranovs avatar Jan 12 '25 07:01 goranovs