diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 4e36a72a4b..2793dfdbe8 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -1540,6 +1540,7 @@ impl Hud { } true } + WinEvent::Zoom(_) => !self.ui.no_widget_capturing_mouse(), WinEvent::KeyDown(Key::Enter) => { if self.typing { self.ui.focus_widget(None); diff --git a/voxygen/src/ui/mod.rs b/voxygen/src/ui/mod.rs index 11ac492547..290f3bc52a 100644 --- a/voxygen/src/ui/mod.rs +++ b/voxygen/src/ui/mod.rs @@ -249,6 +249,7 @@ impl Ui { // Workaround because conrod currently gives us no way to programmatically set which widget is capturing key input // Note the widget must be visible and not covered by other widgets at its center for this to work // Accepts option so widget can be "unfocused" + // TODO: try https://docs.rs/conrod_core/0.63.0/conrod_core/struct.Ui.html#method.keyboard_capture pub fn focus_widget(&mut self, id: Option) { let (x, y) = match id { // get position of widget @@ -272,6 +273,10 @@ impl Ui { ); } + // Get whether the a widget besides the window is capturing the mouse + pub fn no_widget_capturing_mouse(&self) -> bool { + self.ui.global_input().current.widget_capturing_mouse.filter(|id| id != &self.ui.window ).is_none() + } pub fn handle_event(&mut self, event: Event) { match event.0 {