@@ -46,7 +46,7 @@ import 'pure_component.dart';
4646part 'design_main_strand.over_react.g.dart' ;
4747
4848typedef ContextMenuStrand = List <ContextMenuItem > Function (Strand strand,
49- {required Domain domain, required Address address, ModificationType type });
49+ {required Domain domain, required Address address, ModificationType modification_type });
5050
5151UiFactory <DesignMainStrandProps > DesignMainStrand = _$DesignMainStrand ;
5252
@@ -414,7 +414,9 @@ api.selectElements([base]);''';
414414 }
415415
416416 List <ContextMenuItem > context_menu_strand (Strand strand,
417- {required Domain domain, required Address address, ModificationType type = ModificationType .internal}) {
417+ {required Domain domain,
418+ required Address address,
419+ ModificationType modification_type = ModificationType .internal}) {
418420 var items = [
419421 ContextMenuItem (
420422 title: 'edit DNA' ,
@@ -443,12 +445,12 @@ assigned, assign the complementary DNA sequence to this strand.
443445 ].build ()),
444446 ContextMenuItem (
445447 title: 'add modification' ,
446- on_click: () => add_modification (domain, address, type ),
448+ on_click: () => add_modification (domain, address, modification_type ),
447449 ),
448450 if (app.state.ui_state.show_oxview)
449451 ContextMenuItem (
450452 title: 'focus in oxView' ,
451- on_click: () => focus_base_oxview (props.strand, domain, address, type ),
453+ on_click: () => focus_base_oxview (props.strand, domain, address, modification_type ),
452454 ),
453455 ContextMenuItem (
454456 title: 'edit vendor fields' ,
@@ -644,14 +646,15 @@ after:
644646 ].build ()),
645647 ContextMenuItem (
646648 title: 'add extension' ,
647- on_click: () => app.disable_keyboard_shortcuts_while (() => ask_for_add_extension (strand, type)),
649+ on_click: () => app.disable_keyboard_shortcuts_while (
650+ () => ask_for_add_extension (strand, (modification_type == ModificationType .five_prime))),
648651 disabled: strand.has_5p_extension && strand.has_3p_extension),
649652 ];
650653
651654 return items;
652655 }
653656
654- Future <void > ask_for_add_extension (Strand strand, ModificationType type ) async {
657+ Future <void > ask_for_add_extension (Strand strand, bool five_prime ) async {
655658 if (strand.has_5p_extension && strand.has_3p_extension) {
656659 // This shouldn't be reachable since the context menu should not include the
657660 // add extension option in this case, but let's check just in case.
@@ -669,7 +672,7 @@ after:
669672 assert (options.isNotEmpty);
670673
671674 int selected_radio_index = 0 ;
672- if ((type == ModificationType .three_prime) && (options.length > 1 )) {
675+ if (! five_prime && (options.length > 1 )) {
673676 selected_radio_index = 1 ;
674677 }
675678 int extension_end_idx = 0 ;
0 commit comments