egui: clear selection when routing is initiated

This commit is contained in:
Mikolaj Wielgus 2024-07-08 01:38:16 +02:00
parent e706134ed0
commit b9a99237a1
2 changed files with 7 additions and 2 deletions

View File

@ -38,6 +38,10 @@ impl Overlay {
})
}
pub fn clear_selection(&mut self) {
self.selection = Selection::new();
}
pub fn click(&mut self, board: &Board<impl AccessMesadata>, at: Point) {
let geoms: Vec<_> = board
.layout()

View File

@ -36,7 +36,7 @@ impl Top {
history_sender: Sender<String>,
arc_mutex_maybe_invoker: Arc<Mutex<Option<Invoker<SpecctraMesadata>>>>,
maybe_execute: &mut Option<ExecuteWithStatus>,
maybe_overlay: &Option<Overlay>,
maybe_overlay: &mut Option<Overlay>,
) {
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)),
));