aboutsummaryrefslogtreecommitdiff
path: root/src/editor.rs
diff options
context:
space:
mode:
authorArne Dußin2021-01-08 16:08:09 +0100
committerArne Dußin2021-01-08 16:08:09 +0100
commitb8a9c3464a7ec4c60073fb4441129fa97b36442a (patch)
treed1147f7b017e7ff7c0fc4895501fe030b038780a /src/editor.rs
parent60327dd3ef85a263173e6275cb122c9191c030fe (diff)
downloadgraf_karto-b8a9c3464a7ec4c60073fb4441129fa97b36442a.tar.gz
graf_karto-b8a9c3464a7ec4c60073fb4441129fa97b36442a.zip
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.
Diffstat (limited to 'src/editor.rs')
-rw-r--r--src/editor.rs19
1 files changed, 11 insertions, 8 deletions
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;
}
}