aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Dußin2020-11-20 20:14:11 +0100
committerArne Dußin2020-11-20 20:14:11 +0100
commitf11b278dda63c851e74fdf3ef2c942192ca6b875 (patch)
treeb57d1557c71f2a03dabfd63d535018a7731da7b1
parent1d9406977e1ba4c22612a51767fa27a9abf0a3bc (diff)
downloadgraf_karto-f11b278dda63c851e74fdf3ef2c942192ca6b875.tar.gz
graf_karto-f11b278dda63c851e74fdf3ef2c942192ca6b875.zip
Fix tools not working
Since the tool sidebar was always setting the currently active tool and that meant even when no change occured, the tool was being deactivated and reactivated, nothing happened except for the icon tool. Now, it's checked if any change is necessary in the editor
-rw-r--r--src/editor.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/editor.rs b/src/editor.rs
index a2eb9c8..2bb5328 100644
--- a/src/editor.rs
+++ b/src/editor.rs
@@ -42,9 +42,11 @@ impl Editor {
/// Set the currently active tool. Any process currently going on in a different tool will be
/// aborted.
pub fn set_active(&mut self, tool: ToolType) {
- self.tools[self.active].deactivate();
- self.active = tool as usize;
- self.tools[self.active].activate();
+ if tool as usize != self.active {
+ self.tools[self.active].deactivate();
+ self.active = tool as usize;
+ self.tools[self.active].activate();
+ }
}
pub fn update(&mut self, rl: &RaylibHandle, transform: &Transform, mouse_blocked: bool) {