Fix notification handling when tool is already selected
This commit is contained in:
parent
0fdc73b9e4
commit
721ad1eecf
|
|
@ -209,11 +209,14 @@ impl<W: Widget<StilettoState>> Controller<StilettoState, W> for ToolSwitcher {
|
|||
match event {
|
||||
Event::Notification(cmd) => {
|
||||
let new_tool = if cmd.get(stiletto::commands::PUSH_ERASER).is_some() {
|
||||
ctx.set_handled();
|
||||
self.saved_tool = data.current_tool;
|
||||
Some(data.eraser_tool_id)
|
||||
} else if cmd.get(stiletto::commands::POP_ERASER).is_some() {
|
||||
ctx.set_handled();
|
||||
Some(self.saved_tool)
|
||||
} else if cmd.get(stiletto::commands::UPDATE_TOOL).is_some() {
|
||||
ctx.set_handled();
|
||||
let old_tool = data.current_tool;
|
||||
data.tool_icons
|
||||
.iter()
|
||||
|
|
@ -225,7 +228,6 @@ impl<W: Widget<StilettoState>> Controller<StilettoState, W> for ToolSwitcher {
|
|||
|
||||
if let Some(new_tool) = new_tool {
|
||||
data.set_tool(new_tool);
|
||||
ctx.set_handled();
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue