mirror of https://codeberg.org/topola/topola.git
feat(egui): add utility method Overlay::take_selection
This commit is contained in:
parent
af312a8a13
commit
24f0a1c699
|
|
@ -324,8 +324,7 @@ impl MenuBar {
|
||||||
arc_mutex_maybe_invoker.lock().unwrap().as_mut(),
|
arc_mutex_maybe_invoker.lock().unwrap().as_mut(),
|
||||||
maybe_overlay,
|
maybe_overlay,
|
||||||
) {
|
) {
|
||||||
let selection = overlay.selection().clone();
|
let selection = overlay.take_selection();
|
||||||
overlay.clear_selection();
|
|
||||||
*maybe_activity = Some(ActivityStepperWithStatus::new_execution(
|
*maybe_activity = Some(ActivityStepperWithStatus::new_execution(
|
||||||
invoker.execute_stepper(Command::RemoveBands(
|
invoker.execute_stepper(Command::RemoveBands(
|
||||||
selection.band_selection,
|
selection.band_selection,
|
||||||
|
|
@ -342,8 +341,7 @@ impl MenuBar {
|
||||||
arc_mutex_maybe_invoker.lock().unwrap().as_mut(),
|
arc_mutex_maybe_invoker.lock().unwrap().as_mut(),
|
||||||
maybe_overlay,
|
maybe_overlay,
|
||||||
) {
|
) {
|
||||||
let selection = overlay.selection().clone();
|
let selection = overlay.take_selection();
|
||||||
overlay.clear_selection();
|
|
||||||
*maybe_activity = Some(ActivityStepperWithStatus::new_execution(
|
*maybe_activity = Some(ActivityStepperWithStatus::new_execution(
|
||||||
invoker.execute_stepper(Command::Autoroute(
|
invoker.execute_stepper(Command::Autoroute(
|
||||||
selection.pin_selection,
|
selection.pin_selection,
|
||||||
|
|
@ -360,8 +358,7 @@ impl MenuBar {
|
||||||
arc_mutex_maybe_invoker.lock().unwrap().as_mut(),
|
arc_mutex_maybe_invoker.lock().unwrap().as_mut(),
|
||||||
maybe_overlay,
|
maybe_overlay,
|
||||||
) {
|
) {
|
||||||
let selection = overlay.selection().clone();
|
let selection = overlay.take_selection();
|
||||||
overlay.clear_selection();
|
|
||||||
*maybe_activity = Some(ActivityStepperWithStatus::new_execution(
|
*maybe_activity = Some(ActivityStepperWithStatus::new_execution(
|
||||||
invoker.execute_stepper(Command::CompareDetours(
|
invoker.execute_stepper(Command::CompareDetours(
|
||||||
selection.pin_selection,
|
selection.pin_selection,
|
||||||
|
|
@ -378,8 +375,7 @@ impl MenuBar {
|
||||||
arc_mutex_maybe_invoker.lock().unwrap().as_mut(),
|
arc_mutex_maybe_invoker.lock().unwrap().as_mut(),
|
||||||
maybe_overlay,
|
maybe_overlay,
|
||||||
) {
|
) {
|
||||||
let selection = overlay.selection().clone();
|
let selection = overlay.take_selection();
|
||||||
overlay.clear_selection();
|
|
||||||
*maybe_activity = Some(ActivityStepperWithStatus::new_execution(
|
*maybe_activity = Some(ActivityStepperWithStatus::new_execution(
|
||||||
invoker.execute_stepper(Command::MeasureLength(
|
invoker.execute_stepper(Command::MeasureLength(
|
||||||
selection.band_selection,
|
selection.band_selection,
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,10 @@ impl Overlay {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn take_selection(&mut self) -> Selection {
|
||||||
|
core::mem::replace(&mut self.selection, Selection::new())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn clear_selection(&mut self) {
|
pub fn clear_selection(&mut self) {
|
||||||
self.selection = Selection::new();
|
self.selection = Selection::new();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue