mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Don't send egui events when it is hidden and as a result these events are also never captured by egui. This fixes issues with the mouse clicks being captured if the mouse was hovered over the egui UI when it was toggled off.
This commit is contained in:
parent
54d5a06a0d
commit
2bada7f02a
@ -33,9 +33,15 @@ pub fn run(mut global_state: GlobalState, event_loop: EventLoop) {
|
||||
|
||||
#[cfg(feature = "egui-ui")]
|
||||
{
|
||||
global_state.egui_state.platform.handle_event(&event);
|
||||
if global_state.egui_state.platform.captures_event(&event) {
|
||||
return;
|
||||
let enabled_for_current_state =
|
||||
states.last().map_or(false, |state| state.egui_enabled());
|
||||
|
||||
// Only send events to the egui UI when it is being displayed.
|
||||
if enabled_for_current_state && global_state.settings.interface.egui_enabled() {
|
||||
global_state.egui_state.platform.handle_event(&event);
|
||||
if global_state.egui_state.platform.captures_event(&event) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user