Skip to content

Commit dfebfda

Browse files
committed
changed type to modification_type and passes a boolean instead of a ModificationType
1 parent 8f420ea commit dfebfda

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

lib/src/view/design_main_strand.dart

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import 'pure_component.dart';
4646
part 'design_main_strand.over_react.g.dart';
4747

4848
typedef 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

5151
UiFactory<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;

lib/src/view/design_main_strand_dna_end.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ class DesignMainDNAEndComponent extends UiComponent2<DesignMainDNAEndProps> with
238238
.context_menu_strand(props.strand,
239239
domain: domain,
240240
address: address,
241-
type: (props.is_5p ? ModificationType.five_prime : ModificationType.three_prime))
241+
modification_type:
242+
(props.is_5p ? ModificationType.five_prime : ModificationType.three_prime))
242243
.build(),
243244
position: util.from_point_num(event.page))));
244245
}

0 commit comments

Comments
 (0)