prevent double-use of Escape key between context and modal menus
@@ -47,20 +47,17 @@ impl ModalMenu {
panic!("Caller didn't consume modal action '{}'", action);
}
+ // Example of a conflict is Escaping out of a context menu.
+ if !ctx.input.event_consumed {
match self.menu.event(ctx.input.event, ctx.canvas) {
InputResult::Canceled | InputResult::StillActive => {}
InputResult::Done(action, _) => {
- //assert!(!ctx.input.event_consumed);
- if ctx.input.event_consumed {
- panic!(
- "{} chosen from ModalMenu, but event {:?} was already consumed",
- action, ctx.input.event
- );
- }
ctx.input.event_consumed = true;
self.chosen_action = Some(action);
}
}
+ }
+
self.menu.mark_all_inactive();
if let Some(txt) = new_prompt {
self.menu.change_prompt(txt, ctx.canvas);
