diff --git a/src/bin/topola-egui/overlay.rs b/src/bin/topola-egui/overlay.rs index 9dfb0a4..cedc5ce 100644 --- a/src/bin/topola-egui/overlay.rs +++ b/src/bin/topola-egui/overlay.rs @@ -38,6 +38,10 @@ impl Overlay { }) } + pub fn clear_selection(&mut self) { + self.selection = Selection::new(); + } + pub fn click(&mut self, board: &Board, at: Point) { let geoms: Vec<_> = board .layout() diff --git a/src/bin/topola-egui/top.rs b/src/bin/topola-egui/top.rs index a24b24e..bc92517 100644 --- a/src/bin/topola-egui/top.rs +++ b/src/bin/topola-egui/top.rs @@ -36,7 +36,7 @@ impl Top { history_sender: Sender, arc_mutex_maybe_invoker: Arc>>>, maybe_execute: &mut Option, - maybe_overlay: &Option, + maybe_overlay: &mut Option, ) { egui::TopBottomPanel::top("top_panel").show(ctx, |ui| { egui::menu::bar(ui, |ui| { @@ -105,11 +105,12 @@ impl Top { if maybe_execute.as_mut().map_or(true, |execute| { matches!(execute.maybe_status(), Some(InvokerStatus::Finished)) }) { - if let (Some(invoker), Some(ref overlay)) = ( + if let (Some(invoker), Some(ref mut overlay)) = ( arc_mutex_maybe_invoker.lock().unwrap().as_mut(), maybe_overlay, ) { let selection = overlay.selection().clone(); + overlay.clear_selection(); maybe_execute.insert(ExecuteWithStatus::new( invoker.execute_walk(Command::Autoroute(selection)), ));