From 22ae227b5a3c30f199d4897a299da25962c7d25f Mon Sep 17 00:00:00 2001 From: Raybipse Date: Sat, 28 Oct 2023 19:01:32 -0700 Subject: [PATCH] Fixed batch remove/set for extensions and loopouts --- lib/src/view/design_main_strand.dart | 5 ++--- lib/src/view/design_main_strand_extension.dart | 18 +++++++++++++----- lib/src/view/design_main_strand_loopout.dart | 18 +++++++++++++----- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/lib/src/view/design_main_strand.dart b/lib/src/view/design_main_strand.dart index ea373ce5..ad57d654 100644 --- a/lib/src/view/design_main_strand.dart +++ b/lib/src/view/design_main_strand.dart @@ -928,7 +928,7 @@ PAGEHPLC : Dual PAGE & HPLC String name = (results[name_idx] as DialogText).value; actions.UndoableAction action = batch_if_multiple_selected( - name_set_strand_action_creator(name), strand, selected_strands, "set strand name"); + name_set_strand_action_creator(name), strand, selected_strands, "set strand names"); app.dispatch(action); } @@ -953,7 +953,6 @@ PAGEHPLC : Dual PAGE & HPLC Future ask_for_label( Strand strand, Substrand substrand, BuiltSet selected_strands) async { - // T is expected to be Strand or Domain String part_name = 'strand'; if (substrand != null) { part_name = substrand.type_description(); @@ -994,7 +993,7 @@ Future ask_for_label( } else { action = actions.BatchAction( selected_strands.map((s) => actions.SubstrandLabelSet(label: label, substrand: (s as Substrand))), - "set domain labels"); + "set substrand labels"); } app.dispatch(action); diff --git a/lib/src/view/design_main_strand_extension.dart b/lib/src/view/design_main_strand_extension.dart index 43437b75..c8fe49be 100644 --- a/lib/src/view/design_main_strand_extension.dart +++ b/lib/src/view/design_main_strand_extension.dart @@ -173,7 +173,10 @@ class DesignMainExtensionComponent extends UiComponent2 app.dispatch(actions.SubstrandNameSet(name: null, substrand: props.ext))), + on_click: () => app.dispatch(actions.BatchAction( + app.state.ui_state.selectables_store.selected_extensions + .map((e) => actions.SubstrandNameSet(name: null, substrand: e)), + "remove extension names"))), ContextMenuItem( title: 'set extension label', on_click: set_extension_label, @@ -181,7 +184,10 @@ class DesignMainExtensionComponent extends UiComponent2 app.dispatch(actions.SubstrandLabelSet(label: null, substrand: props.ext))), + on_click: () => app.dispatch(actions.BatchAction( + app.state.ui_state.selectables_store.selected_extensions + .map((e) => actions.SubstrandLabelSet(label: null, substrand: e)), + "remove extension labels"))), ContextMenuItem( title: 'set extension color', on_click: () => app @@ -217,7 +223,7 @@ class DesignMainExtensionComponent extends UiComponent2 app.disable_keyboard_shortcuts_while(() => design_main_strand.ask_for_label( props.strand, props.ext, - app.state.ui_state.selectables_store.selected_substrands, + app.state.ui_state.selectables_store.selected_extensions, )); Future ask_for_extension_name() async { @@ -230,8 +236,10 @@ class DesignMainExtensionComponent extends UiComponent2 actions.SubstrandNameSet(name: name, substrand: e)), + "set extension names")); } extension_display_length_and_angle_change() => diff --git a/lib/src/view/design_main_strand_loopout.dart b/lib/src/view/design_main_strand_loopout.dart index 42ae9953..5b55b4c5 100644 --- a/lib/src/view/design_main_strand_loopout.dart +++ b/lib/src/view/design_main_strand_loopout.dart @@ -166,7 +166,10 @@ class DesignMainLoopoutComponent extends UiStatefulComponent2 app.dispatch(actions.SubstrandNameSet(name: null, substrand: props.loopout))), + on_click: () => app.dispatch(actions.BatchAction( + app.state.ui_state.selectables_store.selected_loopouts + .map((l) => actions.SubstrandNameSet(name: null, substrand: l)), + "remove loopout names"))), ContextMenuItem( title: 'set loopout label', on_click: set_loopout_label, @@ -174,7 +177,10 @@ class DesignMainLoopoutComponent extends UiStatefulComponent2 app.dispatch(actions.SubstrandLabelSet(substrand: props.loopout, label: null))), + on_click: () => app.dispatch(actions.BatchAction( + app.state.ui_state.selectables_store.selected_loopouts + .map((l) => actions.SubstrandLabelSet(label: null, substrand: l)), + "remove loopout names"))), ContextMenuItem( title: 'set loopout color', on_click: () => app.dispatch( @@ -224,7 +230,7 @@ class DesignMainLoopoutComponent extends UiStatefulComponent2 app.disable_keyboard_shortcuts_while(() => design_main_strand.ask_for_label( props.strand, props.loopout, - app.state.ui_state.selectables_store.selected_substrands, + app.state.ui_state.selectables_store.selected_loopouts, )); Future ask_for_loopout_name() async { @@ -237,8 +243,10 @@ class DesignMainLoopoutComponent extends UiStatefulComponent2 actions.SubstrandNameSet(name: name, substrand: l)), + "set loopout names")); } String loopout_path_description_between_groups() {