Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…/scadnano into dev
  • Loading branch information
rayzhuca committed Dec 21, 2023
2 parents 94c0b0f + f6fd975 commit 5d4cc56
Show file tree
Hide file tree
Showing 22 changed files with 166 additions and 29 deletions.
19 changes: 19 additions & 0 deletions lib/src/actions/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4348,6 +4348,25 @@ abstract class DisablePngCachingDnaSequencesSet
_$disablePngCachingDnaSequencesSetSerializer;
}

abstract class RetainStrandColorOnSelectionSet
with BuiltJsonSerializable
implements Action, Built<RetainStrandColorOnSelectionSet, RetainStrandColorOnSelectionSetBuilder> {
bool get retain_strand_color_on_selection;

/************************ begin BuiltValue boilerplate ************************/
factory RetainStrandColorOnSelectionSet(bool retain_strand_color_on_selection) =>
RetainStrandColorOnSelectionSet.from(
(b) => b..retain_strand_color_on_selection = retain_strand_color_on_selection);

factory RetainStrandColorOnSelectionSet.from(
[void Function(RetainStrandColorOnSelectionSetBuilder) updates]) = _$RetainStrandColorOnSelectionSet;

RetainStrandColorOnSelectionSet._();

static Serializer<RetainStrandColorOnSelectionSet> get serializer =>
_$retainStrandColorOnSelectionSetSerializer;
}

abstract class DisplayReverseDNARightSideUpSet
with BuiltJsonSerializable
implements Action, Built<DisplayReverseDNARightSideUpSet, DisplayReverseDNARightSideUpSetBuilder> {
Expand Down
1 change: 1 addition & 0 deletions lib/src/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ const css_selector_deletion = 'deletion-cross';
const css_selector_insertion_group = 'insertion-group';
const css_selector_deletion_group = 'deletion-group';
const css_selector_selected = 'selected';
const css_selector_selected_pink = 'selected-pink';

const css_selector_context_menu_item_disabled = 'context_menu_item_disabled';

Expand Down
4 changes: 4 additions & 0 deletions lib/src/reducers/app_ui_state_reducer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ int slice_bar_offset_set_reducer(int _, actions.SliceBarOffsetSet action) => act
bool disable_png_caching_dna_sequences_reducer(bool _, actions.DisablePngCachingDnaSequencesSet action) =>
action.disable_png_caching_dna_sequences;

bool retain_strand_color_on_selection_reducer(bool _, actions.RetainStrandColorOnSelectionSet action) =>
action.retain_strand_color_on_selection;

bool display_reverse_DNA_right_side_up_reducer(bool _, actions.DisplayReverseDNARightSideUpSet action) =>
action.display_reverse_DNA_right_side_up;

Expand Down Expand Up @@ -434,6 +437,7 @@ AppUIStateStorables app_ui_state_storable_local_reducer(AppUIStateStorables stor
..show_slice_bar = TypedReducer<bool, actions.ShowSliceBarSet>(show_slice_bar_reducer)(storables.show_slice_bar, action)
..slice_bar_offset = TypedReducer<int, actions.SliceBarOffsetSet>(slice_bar_offset_set_reducer)(storables.slice_bar_offset, action)
..disable_png_caching_dna_sequences = TypedReducer<bool, actions.DisablePngCachingDnaSequencesSet>(disable_png_caching_dna_sequences_reducer)(storables.disable_png_caching_dna_sequences, action)
..retain_strand_color_on_selection = TypedReducer<bool, actions.RetainStrandColorOnSelectionSet>(retain_strand_color_on_selection_reducer)(storables.retain_strand_color_on_selection, action)
..display_reverse_DNA_right_side_up = TypedReducer<bool, actions.DisplayReverseDNARightSideUpSet>(display_reverse_DNA_right_side_up_reducer)(storables.display_reverse_DNA_right_side_up, action)
..local_storage_design_choice = TypedReducer<LocalStorageDesignChoice, actions.LocalStorageDesignChoiceSet>(local_storage_design_choice_reducer)(storables.local_storage_design_choice, action).toBuilder()
..clear_helix_selection_when_loading_new_design = TypedReducer<bool, actions.ClearHelixSelectionWhenLoadingNewDesignSet>(clear_helix_selection_when_loading_new_design_set_reducer)(storables.clear_helix_selection_when_loading_new_design, action)
Expand Down
1 change: 1 addition & 0 deletions lib/src/serializers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ part 'serializers.g.dart';
SetDisplayMajorTickWidthsAllHelices,
SliceBarOffsetSet,
DisablePngCachingDnaSequencesSet,
RetainStrandColorOnSelectionSet,
DisplayReverseDNARightSideUpSet,
SliceBarMoveStart,
SliceBarMoveStop,
Expand Down
2 changes: 2 additions & 0 deletions lib/src/state/app_ui_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ abstract class AppUIState with BuiltJsonSerializable implements Built<AppUIState

bool get disable_png_caching_dna_sequences => storables.disable_png_caching_dna_sequences;

bool get retain_strand_color_on_selection => storables.retain_strand_color_on_selection;

bool get display_reverse_DNA_right_side_up => storables.display_reverse_DNA_right_side_up;

bool get show_mouseover_data => storables.show_mouseover_data;
Expand Down
3 changes: 3 additions & 0 deletions lib/src/state/app_ui_state_storables.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ abstract class AppUIStateStorables

bool get disable_png_caching_dna_sequences;

bool get retain_strand_color_on_selection;

bool get display_reverse_DNA_right_side_up;

bool get selection_box_intersection;
Expand Down Expand Up @@ -173,6 +175,7 @@ abstract class AppUIStateStorables
b.show_slice_bar = false;
b.slice_bar_offset = null;
b.disable_png_caching_dna_sequences = false;
b.retain_strand_color_on_selection = false;
b.display_reverse_DNA_right_side_up = false;
b.local_storage_design_choice = LocalStorageDesignChoice().toBuilder();
b.clear_helix_selection_when_loading_new_design = false;
Expand Down
3 changes: 3 additions & 0 deletions lib/src/view/design_main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ UiFactory<DesignMainProps> ConnectedDesignMain = connect<AppState, DesignMainPro
..invert_y = state.ui_state.invert_y
..selection_rope = state.ui_state.selection_rope
..disable_png_caching_dna_sequences = state.ui_state.disable_png_caching_dna_sequences
..retain_strand_color_on_selection = state.ui_state.retain_strand_color_on_selection
..display_reverse_DNA_right_side_up = state.ui_state.display_reverse_DNA_right_side_up);
}
},
Expand Down Expand Up @@ -137,6 +138,7 @@ mixin DesignMainPropsMixin on UiProps {
String displayed_group_name;
SelectionRope selection_rope;
bool disable_png_caching_dna_sequences;
bool retain_strand_color_on_selection;
bool display_reverse_DNA_right_side_up;
BuiltMap<int, Point<num>> helix_idx_to_svg_position_map;
bool invert_y;
Expand Down Expand Up @@ -263,6 +265,7 @@ class DesignMainComponent extends UiComponent2<DesignMainProps> {
..only_display_selected_helices = props.only_display_selected_helices
..helix_idx_to_svg_position_map = props.helix_idx_to_svg_position_map
..disable_png_caching_dna_sequences = props.disable_png_caching_dna_sequences
..retain_strand_color_on_selection = props.retain_strand_color_on_selection
..display_reverse_DNA_right_side_up = props.display_reverse_DNA_right_side_up
..key = 'dna-sequences')(),

Expand Down
1 change: 1 addition & 0 deletions lib/src/view/design_main_dna_sequences.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ mixin DesignMainDNASequencesProps on UiProps {
bool only_display_selected_helices;
BuiltMap<int, Point<num>> helix_idx_to_svg_position_map;
bool disable_png_caching_dna_sequences;
bool retain_strand_color_on_selection;
bool display_reverse_DNA_right_side_up;
}

Expand Down
15 changes: 12 additions & 3 deletions lib/src/view/design_main_strand.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ mixin DesignMainStrandPropsMixin on UiProps {
num modification_font_size;
bool invert_y;
BuiltMap<int, Point<num>> helix_idx_to_svg_position_map;
bool retain_strand_color_on_selection;
}

class DesignMainStrandProps = UiProps with DesignMainStrandPropsMixin, TransformByHelixGroupPropsMixin;
Expand All @@ -100,7 +101,11 @@ class DesignMainStrandComponent extends UiComponent2<DesignMainStrandProps>

var classname = constants.css_selector_strand;
if (props.selected) {
classname += ' ' + constants.css_selector_selected;
if (props.retain_strand_color_on_selection) {
classname += ' ' + constants.css_selector_selected;
} else {
classname += ' ' + constants.css_selector_selected_pink;
}
}
if (props.strand.is_scaffold) {
classname += ' ' + constants.css_selector_scaffold;
Expand Down Expand Up @@ -149,7 +154,8 @@ class DesignMainStrandComponent extends UiComponent2<DesignMainStrandProps>
..moving_dna_ends = props.moving_dna_ends
..geometry = props.geometry
..helix_idx_to_svg_position_map = helix_idx_to_svg_position_y_map_on_strand
..only_display_selected_helices = props.only_display_selected_helices)(),
..only_display_selected_helices = props.only_display_selected_helices
..retain_strand_color_on_selection = props.retain_strand_color_on_selection)(),
_insertions(),
_deletions(),
if (props.show_domain_names ||
Expand Down Expand Up @@ -188,6 +194,7 @@ class DesignMainStrandComponent extends UiComponent2<DesignMainStrandProps>
..display_connector = props.modification_display_connector
..helix_idx_to_svg_position_y_map =
props.helix_idx_to_svg_position_map.map((i, p) => MapEntry(i, p.y))
..retain_strand_color_on_selection = props.retain_strand_color_on_selection
..key = 'modifications')(),
]);
}
Expand Down Expand Up @@ -301,6 +308,7 @@ class DesignMainStrandComponent extends UiComponent2<DesignMainStrandProps>
..transform = transform_of_helix(domain.helix)
..svg_position_y = props.helix_idx_to_svg_position_map[helix.idx].y
..display_reverse_DNA_right_side_up = props.display_reverse_DNA_right_side_up
..retain_strand_color_on_selection = props.retain_strand_color_on_selection
..key = util.id_insertion(domain, selectable_insertion.insertion.offset))());
}
}
Expand Down Expand Up @@ -335,6 +343,7 @@ class DesignMainStrandComponent extends UiComponent2<DesignMainStrandProps>
..selected = props.selected_deletions_in_strand.contains(selectable_deletion)
..transform = transform_of_helix(domain.helix)
..svg_position_y = props.helix_idx_to_svg_position_map[domain.helix].y
..retain_strand_color_on_selection = props.retain_strand_color_on_selection
..key = id)());
}
}
Expand Down Expand Up @@ -481,7 +490,7 @@ assigned, assign the complementary DNA sequence to this strand.
(strand) => actions.StrandNameSet(name: null, strand: strand),
props.strand,
app.state.ui_state.selectables_store.selected_strands,
'remove strand label'))),
'remove strand name'))),
ContextMenuItem(
title: 'set domain name',
on_click: () => set_domain_names(get_selected_domains()),
Expand Down
7 changes: 6 additions & 1 deletion lib/src/view/design_main_strand_crossover.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ mixin DesignMainStrandCrossoverPropsMixin on UiProps {
Geometry geometry;
num prev_domain_helix_svg_position_y;
num next_domain_helix_svg_position_y;
bool retain_strand_color_on_selection;
}

class DesignMainStrandCrossoverProps = UiProps
Expand All @@ -63,7 +64,11 @@ class DesignMainStrandCrossoverComponent

var classname = constants.css_selector_crossover;
if (props.selected) {
classname += ' ' + constants.css_selector_selected;
if (props.retain_strand_color_on_selection) {
classname += ' ' + constants.css_selector_selected;
} else {
classname += ' ' + constants.css_selector_selected_pink;
}
}
if (props.strand.is_scaffold) {
classname += ' ' + constants.css_selector_scaffold;
Expand Down
7 changes: 6 additions & 1 deletion lib/src/view/design_main_strand_deletion.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ mixin DesignMainStrandDeletionPropsMixin on UiProps {
Domain get domain => selectable_deletion.domain;
int get deletion => selectable_deletion.offset;
num svg_position_y;
bool retain_strand_color_on_selection;
}

class DesignMainStrandDeletionProps = UiProps with DesignMainStrandDeletionPropsMixin;
Expand Down Expand Up @@ -55,7 +56,11 @@ class DesignMainStrandDeletionComponent extends UiComponent2<DesignMainStrandDel

var classname = constants.css_selector_deletion_group;
if (props.selected) {
classname += ' ' + constants.css_selector_selected;
if (props.retain_strand_color_on_selection) {
classname += ' ' + constants.css_selector_selected;
} else {
classname += ' ' + constants.css_selector_selected_pink;
}
}
if (props.selectable_deletion.is_scaffold) {
classname += ' ' + constants.css_selector_scaffold;
Expand Down
7 changes: 6 additions & 1 deletion lib/src/view/design_main_strand_dna_end.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ mixin DesignMainDNAEndPropsMixin on UiProps {
bool drawing_potential_crossover;
bool moving_this_dna_end;
Point<num> helix_svg_position;
bool retain_strand_color_on_selection;
}

class DesignMainDNAEndProps = UiProps with DesignMainDNAEndPropsMixin;
Expand Down Expand Up @@ -94,7 +95,11 @@ class DesignMainDNAEndComponent extends UiComponent2<DesignMainDNAEndProps> with
}

if (props.selected) {
classname += ' ' + constants.css_selector_selected;
if (props.retain_strand_color_on_selection) {
classname += ' ' + constants.css_selector_selected;
} else {
classname += ' ' + constants.css_selector_selected_pink;
}
}
if (props.is_scaffold) {
classname += ' ' + constants.css_selector_scaffold;
Expand Down
7 changes: 6 additions & 1 deletion lib/src/view/design_main_strand_domain.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ mixin DesignMainDomainPropsMixin on UiProps {
BuiltMap<int, Helix> helices;
BuiltMap<String, HelixGroup> groups;
Geometry geometry;
bool retain_strand_color_on_selection;
}

class DesignMainDomainProps = UiProps with DesignMainDomainPropsMixin, TransformByHelixGroupPropsMixin;
Expand All @@ -70,7 +71,11 @@ class DesignMainDomainComponent extends UiComponent2<DesignMainDomainProps>

var classname = constants.css_selector_domain;
if (props.selected) {
classname += ' ' + constants.css_selector_selected;
if (props.retain_strand_color_on_selection) {
classname += ' ' + constants.css_selector_selected;
} else {
classname += ' ' + constants.css_selector_selected_pink;
}
}
if (props.strand.is_scaffold) {
classname += ' ' + constants.css_selector_scaffold;
Expand Down
7 changes: 6 additions & 1 deletion lib/src/view/design_main_strand_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ mixin DesignMainExtensionPropsMixin on UiProps {
BuiltMap<int, Helix> helices;
BuiltMap<String, HelixGroup> groups;
Geometry geometry;
bool retain_strand_color_on_selection;
}

class DesignMainExtensionProps = UiProps with DesignMainExtensionPropsMixin, TransformByHelixGroupPropsMixin;
Expand All @@ -76,7 +77,11 @@ class DesignMainExtensionComponent extends UiComponent2<DesignMainExtensionProps

var classname = constants.css_selector_extension;
if (props.selected) {
classname += ' ' + constants.css_selector_selected;
if (props.retain_strand_color_on_selection) {
classname += ' ' + constants.css_selector_selected;
} else {
classname += ' ' + constants.css_selector_selected_pink;
}
}
if (props.strand.is_scaffold) {
classname += ' ' + constants.css_selector_scaffold;
Expand Down
8 changes: 7 additions & 1 deletion lib/src/view/design_main_strand_insertion.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ mixin DesignMainStrandInsertionPropsMixin on UiProps {
Insertion get insertion => selectable_insertion.insertion;

Domain get domain => selectable_insertion.domain;

bool retain_strand_color_on_selection;
}

class DesignMainStrandInsertionProps = UiProps with DesignMainStrandInsertionPropsMixin;
Expand All @@ -50,7 +52,11 @@ class DesignMainStrandInsertionComponent extends UiComponent2<DesignMainStrandIn
render() {
var classname = constants.css_selector_insertion_group;
if (props.selected) {
classname += ' ' + constants.css_selector_selected;
if (props.retain_strand_color_on_selection) {
classname += ' ' + constants.css_selector_selected;
} else {
classname += ' ' + constants.css_selector_selected_pink;
}
}
if (props.selectable_insertion.is_scaffold) {
classname += ' ' + constants.css_selector_scaffold;
Expand Down
7 changes: 6 additions & 1 deletion lib/src/view/design_main_strand_loopout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ mixin DesignMainLoopoutPropsMixin on UiProps {
Geometry geometry;
num prev_helix_svg_position_y;
num next_helix_svg_position_y;
bool retain_strand_color_on_selection;
}

class DesignMainLoopoutProps = UiProps with DesignMainLoopoutPropsMixin, TransformByHelixGroupPropsMixin;
Expand All @@ -69,7 +70,11 @@ class DesignMainLoopoutComponent extends UiStatefulComponent2<DesignMainLoopoutP
render() {
var classname = constants.css_selector_loopout;
if (props.selected) {
classname += ' ' + constants.css_selector_selected;
if (props.retain_strand_color_on_selection) {
classname += ' ' + constants.css_selector_selected;
} else {
classname += ' ' + constants.css_selector_selected_pink;
}
}
if (props.strand.is_scaffold) {
classname += ' ' + constants.css_selector_scaffold;
Expand Down
8 changes: 7 additions & 1 deletion lib/src/view/design_main_strand_modification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ mixin DesignMainStrandModificationProps on UiProps {
num helix_svg_position_y;

Extension ext; // optional; used if mod is on extension

bool retain_strand_color_on_selection;
}

class DesignMainStrandModificationComponent extends UiComponent2<DesignMainStrandModificationProps> {
Expand Down Expand Up @@ -87,7 +89,11 @@ class DesignMainStrandModificationComponent extends UiComponent2<DesignMainStran
}

if (props.selected) {
classname += ' ' + constants.css_selector_selected;
if (props.retain_strand_color_on_selection) {
classname += ' ' + constants.css_selector_selected;
} else {
classname += ' ' + constants.css_selector_selected_pink;
}
}
if (props.strand.is_scaffold) {
classname += ' ' + constants.css_selector_scaffold;
Expand Down
5 changes: 5 additions & 0 deletions lib/src/view/design_main_strand_modifications.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ mixin DesignMainStrandModificationsPropsMixin on UiProps {

BuiltSet<SelectableModification> selected_modifications_in_strand;
BuiltMap<int, num> helix_idx_to_svg_position_y_map;

bool retain_strand_color_on_selection;
}

class DesignMainStrandModificationsProps = UiProps
Expand Down Expand Up @@ -65,6 +67,7 @@ class DesignMainStrandModificationsComponent extends UiComponent2<DesignMainStra
..helix_svg_position_y = props.helix_idx_to_svg_position_y_map[helix_5p.idx]
..ext = ext
..geometry = props.geometry
..retain_strand_color_on_selection = props.retain_strand_color_on_selection
..key = "5'")());
}
}
Expand All @@ -88,6 +91,7 @@ class DesignMainStrandModificationsComponent extends UiComponent2<DesignMainStra
..helix_svg_position_y = props.helix_idx_to_svg_position_y_map[helix_3p.idx]
..ext = ext
..geometry = props.geometry
..retain_strand_color_on_selection = props.retain_strand_color_on_selection
..key = "3'")());
}
}
Expand Down Expand Up @@ -125,6 +129,7 @@ class DesignMainStrandModificationsComponent extends UiComponent2<DesignMainStra
..dna_idx_mod = dna_idx_mod
..helix_svg_position_y = props.helix_idx_to_svg_position_y_map[helix.idx]
..geometry = props.geometry
..retain_strand_color_on_selection = props.retain_strand_color_on_selection
..key = "internal-${dna_idx_mod}")());
}
} else if (ss_with_mod is Loopout) {
Expand Down
Loading

0 comments on commit 5d4cc56

Please sign in to comment.