You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to stop my engine to react to pointer events while it's over egui or is otherwise interacting with it, and Context::wants_pointer_input() seems to be exactly for this.
It works very well, however if you hover over e.g. a dropdown and press a mouse button, then suddenly this function returns false. This means that when I'm clicking a dropdown I may accidentally select an object behind the GUI.
UPD. I just realised it's true not only for dropdowns but for general dragging over panels etc. as well -- presumably because the function wants to make sure that if a drag started outside UI then it won't grab the cursor, but what that means that if you start the drag while over the UI but not over an active element (e.g. a slider) then the function will erroneously assume it's outside UI.
The text was updated successfully, but these errors were encountered:
This is by design (though perhaps a bit confusing). It works like this:
If you are hovering an egui area, then wants_pointer_input = true, because egui may want to do hover effects.
If you drag an egui widget that responds to drags (e..g. a slider), then wants_pointer_input returns true, because egui needs to track the mouse. it doesn't matter where the mouse is (i.e. if it leaves an egui area).
If your mouse button is down but you are not clicking or dragging any widget, then egui assumes you are interacting with your game (or whatever).
Perhaps wants_pointer_input should return true if the drag originated in an egui area, even if there is nothing there to drag, but this requires keeping track of more state, do that's not how it currently works. As @jsatka points out: you can use Context::is_pointer_over_area to augment this for now.
I was trying to stop my engine to react to pointer events while it's over egui or is otherwise interacting with it, and
Context::wants_pointer_input()
seems to be exactly for this.It works very well, however if you hover over e.g. a dropdown and press a mouse button, then suddenly this function returns false. This means that when I'm clicking a dropdown I may accidentally select an object behind the GUI.
I've reproduced the problem on the official egui_glium example and recorded a screencast to demonstrate: https://www.youtube.com/watch?v=pGcuXdO0yxc
Thanks for the great crate!
UPD. I just realised it's true not only for dropdowns but for general dragging over panels etc. as well -- presumably because the function wants to make sure that if a drag started outside UI then it won't grab the cursor, but what that means that if you start the drag while over the UI but not over an active element (e.g. a slider) then the function will erroneously assume it's outside UI.
The text was updated successfully, but these errors were encountered: