From b8a9c3464a7ec4c60073fb4441129fa97b36442a Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Fri, 8 Jan 2021 16:08:09 +0100 Subject: Fix CLI not capturing keyboard This is not a very nice solution and is due to limitations of raylib. Since I want to change the way input is handled in the future this is an okay solution, but when overhauling the input needs to be changed. --- src/editor.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/editor.rs') diff --git a/src/editor.rs b/src/editor.rs index 2cf2e41..abbc401 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -112,18 +112,21 @@ impl Editor { transform: &Transform, snapper: &Snapper, mouse_blocked: bool, + keyboard_captured: bool, ) { // Handle keybindings for tool change - for (&tool_type, (_, activation_key)) in self.tools.iter() { - if activation_key.is_pressed(rl, false) { - // Don't do anything if the tool does not change. - if tool_type == self.active { + if !keyboard_captured { + for (&tool_type, (_, activation_key)) in self.tools.iter() { + if activation_key.is_pressed(rl, false) { + // Don't do anything if the tool does not change. + if tool_type == self.active { + break; + } + + // Activate the tool of which the key binding has been pressed. + self.set_active(tool_type); break; } - - // Activate the tool of which the key binding has been pressed. - self.set_active(tool_type); - break; } } -- cgit v1.2.3-70-g09d2