Mouse Wheel Event Handling Issue with Multiple ScrollContainers #12283
HorsesElectricStick
started this conversation in
GUI
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In my interface with multiple ScrollContainers, when I hover my mouse over any ScrollContainer, the mouse wheel events are correctly handled by the container under the cursor.
However, when I press and hold the left mouse button on one ScrollContainer and then drag the mouse to another ScrollContainer area, the wheel events continue to be processed by the initially clicked container, not the one currently under the cursor.
This becomes inconvenient during drag and drop operations or UI interactions, as users cannot scroll other containers during the drag process.
I tried a slightly tedious approach :
call grab_click_focus() when the mouse_entered() signal of the ScrollContainer is triggered.
This ensures that dragging will scroll the ScrollContainer under the mouse. However, this also made the ScrollContainer’s scrollbar unusable - it’s easy to lose focus when dragging the scrollbar.
To solve this, I added a controller that makes the ScrollContainer emit a request focus signal when the mouse enters it. The controller then decides whether to allow grabbing focus (e.g., only allowing focus grab during item dragging).
So far, this solution currently works well in my project, but it might not be universally applicable. I don't know if grab_click_focus() will cause other problems, such as affecting UI navigation.
Beta Was this translation helpful? Give feedback.
All reactions