I always enable the touch screen mouse emulation option; otherwise, it’s impossible to click on the UI on mobile devices.
Recently, I have encountered two issues. When I use a scroll container, touch scrolling triggers both clicking and scrolling simultaneously. Additionally, if an ItemList is placed inside the scroll container, touch scrolling becomes unusable. I have been struggling with this problem for a while and hope to receive some assistance.
The ItemList node has its own vertical scroll logic so adding it to a ScrollContainer does not have any effect. If you want the ScrollContainer to scroll the ItemList then you need to set in the ItemList its Control.mouse_filter property to Pass and its ItemList.auto_height to true you may want to also set its ItemList.focusStyleBox to StyleBoxEmpty.
Can you clarify what you mean? A touch will trigger clicking and a drag will trigger scrolling but it’s not possible to drag before touching.
First of all, thank you for your help! When I drag within a scroll container that contains buttons or other clickable elements, it inadvertently triggers the click event of the buttons.
Hello . Try when not scrolling to process the release of the button
func _ready() → void:
scroll_container.scroll_started.connect(ms_scroll_started)
scroll_container.scroll_ended.connect(ms_scroll_ended)
func ms_scroll_started():
scrolling_p2=true
func ms_scroll_ended():
scrolling_p2=false
func _on_btn_1_button_up( ) → void:
if !scrolling_p2: print(“not scroll, but touch_UP”)