From f11b278dda63c851e74fdf3ef2c942192ca6b875 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Fri, 20 Nov 2020 20:14:11 +0100 Subject: 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 --- src/editor.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3-70-g09d2