Replies: 1 comment
-
Here's a hacky way I reroute key events "around" the main let is_modal_showing = c.vm.modal_id != ModalId::None;
let mut events = Vec::new();
if is_modal_showing {
ctx.input_mut(|input| events.append(&mut input.events));
}
egui::CentralPanel::default()
.frame(
Frame::none()
.inner_margin({
let margins = c.get_window_margins();
Margin::symmetric(margins.x, margins.y)
})
.fill(Color32::WHITE)
)
.show(ctx, |ui| {
self.build_MainPage(ui, &c);
})
.inner;
if is_modal_showing {
ctx.input_mut(|input| input.events.append(&mut events));
log_if_changed!("{:?}", ctx.input(|i| i.events.clone()));
show_modal(ctx, &c);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've implemented a modal popup that is rendered last, after rendering a dimming
Ui
, which is after rendering the mainUi
. The dimmingUi
paints a rect over the main UI and intercepts mouse events.How can I react to keyboard input in the dialog, and forbid all keypresses, touches, mouse input from reaching the main UI "behind" the dimming
Ui
?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions