SpyrexDE / SmoothScroll

Addon for the Godot Game Engine that adds a SmoothScrollContainer.
https://spyrexde.github.io/SmoothScroll/
MIT License
132 stars 10 forks source link

Signals of SmoothScrollContainer children are not properly evaluated when dragging #23

Closed MadFlyFish closed 1 year ago

MadFlyFish commented 1 year ago

As a contrast, the button in original ScrollContainer will not trigger "pressed' signal when being dragged image Here is my reproduction project. Thanks. SmoothScrollContainer.zip

SpyrexDE commented 1 year ago

From the official godot documentation:

The input event propagates up through the node tree until a node consumes it.

This means that this is standard behaviour for any control element and Godot's native scroll containers are handled differently in the background. Due to this a workaround is needed like disabling all input of the children nodes (Node.set_process_input(false)) until the smooth scroll container handled them and propergates them to the children.

If someone has a different solution let me know.

Edit: My solution is not practically feasible because of how GUI input is meant to be handled. Just imagine how large text wont be selectable anymore because the smooth scroll container would detect those dragging inputs as scrolling.

SpyrexDE commented 1 year ago

I could work out a solution where every control node child's focus gets removed when dragging.

https://github.com/SpyrexDE/SmoothScroll/assets/57133330/2bd91ade-89e3-4f8b-8d92-2c537a900119

This obviously removes any possibility for the inner controls to react to the input of this type (like selecting text). Feedback would be great.

https://github.com/SpyrexDE/SmoothScroll/assets/57133330/6b3f20c4-b088-43b4-9a73-30527d9cb302

MadFlyFish commented 1 year ago

Thanks for the help. In my case, I don't need to select any Label in the SmoothScrollContainer, but I really need the buttons not to be pressed when being dragged, just as the native ScrollContainer does. If there is any version for testing with the walkaround mentioned above, I would love to test it. Thank You. Great addon.

SpyrexDE commented 1 year ago

Sure, here is the demo project: demo.zip

I would agree that not having drag input for child controls is not as bad as false input when dragging so I will release a new version of the plugin soon that will work this way. Nonetheless, I will keep an eye out for a better solution. Thanks for reporting this issue!