godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.96k stars 21.08k forks source link

gui_input() stops on the scrollbar of a ScrollContainer #95670

Open Koomball opened 1 month ago

Koomball commented 1 month ago

Tested versions

System information

Godot v4.3.stable - Windows 10.0.19045 - GLES3 (Compatibility) - Intel(R) HD Graphics 620 (Intel Corporation; 31.0.101.2111) - Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz (4 Threads)

Issue description

When using the signal gui_signal() hovering over the scrollbar part of it does not trigger the signal, im unsure if this is a bug but it feels like one as every other part of the container triggers the signal.

extends Node2D

var on_ui : bool = false

func _process(_delta):
    print(on_ui)
    on_ui = false

func on_gui_input(_event):
    on_ui = true

Steps to reproduce

  1. Create Scrollbar with an overflow so the scrollbar appears
  2. Add the code above and link the signal gui_input(event) to the function on_gui_input(_event)
  3. Run the game and run the cursor up and down the scrollbar and it will continue to output false

Im unsure if this is a bug but running my cursor on anything else that i have linked to my function with gui_input(event) always triggers the function.

Minimal reproduction project (MRP)

N/A

kitbdev commented 1 month ago

This is because the ScrollContainer doesn't want the events from the ScrollBars, so it doesn't have them propagated. To get the gui events from the scrollbars you can use get_v_scroll_bar() and get_h_scroll_bar() and connect to their gui_input signal.