godotengine / godot

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

Control focus inside viewport will get stuck after mouse wheel scroll (e.g. in a scroll container) #35941

Open jamie-pate opened 4 years ago

jamie-pate commented 4 years ago

Godot version: 3.2-stable

OS/device including version: Distributor ID: Ubuntu Description: Pop!_OS 19.10 Release: 19.10 Codename: eoan

(Happens on windows as well)

Issue description: When the mouse wheel is used to scroll a scroll container inside a viewport, the currently focused control will steal focus and block any further mouse movement events from reaching controls inside the viewport. (gui.mouse_focus gets set and never released)

Steps to reproduce: Create a viewport scene (like the '2d in 3d demo' and add a scroll container with overflowing content such as a vboxcontainer full of buttons. Use the mouse wheel and notice that you can't click on any other buttons until after the mouse is moved out of the window or the viewport's mouse focus is reset some other way.

NOTE I've discovered that it only happens when the viewport has handle_input_locally=false This may mean that this as 'not a bug' but I'll still leave this report for future generations ;)

Minimal reproduction project: gui_in_3d_mfocus_scrollwheel_repro.zip

jamie-pate commented 4 years ago

I'd say this is really a documentation bug as the handle_input_locally flag is not documented. It should probably include a description of this situation, a reference to the gui in 3d demo project and why you would enable this flag.

KoBeWi commented 3 years ago

Still valid in 3.2.4 beta4, can't test on master, because project is broken.

I'd say this is a valid bug, I don't see why handle_input_locally would affect the scroll in this way.

paulmiller commented 1 year ago

Has this been fixed? I tried your attached project in Godot 3.5.1 and was able to scroll and then press buttons without moving the cursor out of the window.