stop zooming when scrolling chat

Former-commit-id: a94f26e30029ef4cff1807c2347cbd2490c4afd7
This commit is contained in:
Imbris 2019-04-14 20:15:12 -04:00
parent 1e90cf68d5
commit 3812e0b58f
2 changed files with 6 additions and 0 deletions

View File

@ -1540,6 +1540,7 @@ impl Hud {
} }
true true
} }
WinEvent::Zoom(_) => !self.ui.no_widget_capturing_mouse(),
WinEvent::KeyDown(Key::Enter) => { WinEvent::KeyDown(Key::Enter) => {
if self.typing { if self.typing {
self.ui.focus_widget(None); self.ui.focus_widget(None);

View File

@ -249,6 +249,7 @@ impl Ui {
// Workaround because conrod currently gives us no way to programmatically set which widget is capturing key input // 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 // 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" // 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<WidgId>) { pub fn focus_widget(&mut self, id: Option<WidgId>) {
let (x, y) = match id { let (x, y) = match id {
// get position of widget // 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) { pub fn handle_event(&mut self, event: Event) {
match event.0 { match event.0 {