Skip to content

Commit

Permalink
Merge branch 'dev' into 789-saved-dialog-for-future
Browse files Browse the repository at this point in the history
  • Loading branch information
Ho-Chih committed Sep 10, 2022
2 parents ec6f3a3 + 07ceee0 commit 979e64c
Show file tree
Hide file tree
Showing 65 changed files with 2,471 additions and 500 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ doc/api/

codenano.html
*.log

todo.txt

todo extensions.txt
149 changes: 133 additions & 16 deletions lib/src/actions/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import '../state/grid.dart';
import '../state/helix.dart';
import '../state/local_storage_design_choice.dart';
import '../state/loopout.dart';
import '../state/extension.dart';
import '../state/modification.dart';
import '../state/position3d.dart';
import '../state/potential_crossover.dart';
Expand Down Expand Up @@ -631,15 +632,18 @@ abstract class ShowUnpairedInsertionDeletionsSet
bool get show_unpaired_insertion_deletions;

factory ShowUnpairedInsertionDeletionsSet(bool show_unpaired_insertion_deletions) =>
ShowUnpairedInsertionDeletionsSet.from((b) => b..show_unpaired_insertion_deletions = show_unpaired_insertion_deletions);
ShowUnpairedInsertionDeletionsSet.from(
(b) => b..show_unpaired_insertion_deletions = show_unpaired_insertion_deletions);

/************************ begin BuiltValue boilerplate ************************/
factory ShowUnpairedInsertionDeletionsSet.from([void Function(ShowUnpairedInsertionDeletionsSetBuilder) updates]) =
_$ShowUnpairedInsertionDeletionsSet;
factory ShowUnpairedInsertionDeletionsSet.from(
[void Function(ShowUnpairedInsertionDeletionsSetBuilder) updates]) =
_$ShowUnpairedInsertionDeletionsSet;

ShowUnpairedInsertionDeletionsSet._();

static Serializer<ShowUnpairedInsertionDeletionsSet> get serializer => _$showUnpairedInsertionDeletionsSetSerializer;
static Serializer<ShowUnpairedInsertionDeletionsSet> get serializer =>
_$showUnpairedInsertionDeletionsSetSerializer;
}

abstract class SetShowEditor
Expand Down Expand Up @@ -1939,22 +1943,131 @@ abstract class StrandPartAction extends Action {
StrandPart get strand_part;
}

abstract class ExtensionDisplayLengthAngleSet
with BuiltJsonSerializable, UndoableAction
implements
StrandPartAction,
Built<ExtensionDisplayLengthAngleSet, ExtensionDisplayLengthAngleSetBuilder> {
Extension get ext;

num get display_length;

num get display_angle;

StrandPart get strand_part => ext;

/************************ begin BuiltValue boilerplate ************************/
factory ExtensionDisplayLengthAngleSet({Extension ext, num display_length, num display_angle}) =>
ExtensionDisplayLengthAngleSet.from((b) => b
..ext.replace(ext)
..display_length = display_length
..display_angle = display_angle);

factory ExtensionDisplayLengthAngleSet.from(
[void Function(ExtensionDisplayLengthAngleSetBuilder) updates]) = _$ExtensionDisplayLengthAngleSet;

ExtensionDisplayLengthAngleSet._();

static Serializer<ExtensionDisplayLengthAngleSet> get serializer =>
_$extensionDisplayLengthAngleSetSerializer;

@override
String short_description() => "change extension display length/angle";
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// add extension to strand

abstract class ExtensionAdd
with BuiltJsonSerializable, UndoableAction
implements SingleStrandAction, Built<ExtensionAdd, ExtensionAddBuilder> {
Strand get strand;

bool get is_5p;

int get num_bases;

/************************ begin BuiltValue boilerplate ************************/
factory ExtensionAdd({Strand strand, bool is_5p, int num_bases}) => ExtensionAdd.from((b) => b
..strand.replace(strand)
..is_5p = is_5p
..num_bases = num_bases);

factory ExtensionAdd.from([void Function(ExtensionAddBuilder) updates]) = _$ExtensionAdd;

ExtensionAdd._();

static Serializer<ExtensionAdd> get serializer => _$extensionAddSerializer;

@override
String short_description() => "add extension to strand";
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// loopout length change
// loopout/extension length change

abstract class ExtensionNumBasesChange
with BuiltJsonSerializable, UndoableAction
implements StrandPartAction, Built<ExtensionNumBasesChange, ExtensionNumBasesChangeBuilder> {
Extension get ext;

int get num_bases;

StrandPart get strand_part => ext;

/************************ begin BuiltValue boilerplate ************************/
factory ExtensionNumBasesChange(Extension ext, int num_bases) => ExtensionNumBasesChange.from((b) => b
..ext.replace(ext)
..num_bases = num_bases);

factory ExtensionNumBasesChange.from([void Function(ExtensionNumBasesChangeBuilder) updates]) =
_$ExtensionNumBasesChange;

ExtensionNumBasesChange._();

static Serializer<ExtensionNumBasesChange> get serializer => _$extensionNumBasesChangeSerializer;

@override
String short_description() => "change extension number of bases";
}

abstract class ExtensionsNumBasesChange
with BuiltJsonSerializable, UndoableAction
implements Built<ExtensionsNumBasesChange, ExtensionsNumBasesChangeBuilder> {
BuiltList<Extension> get extensions;

int get num_bases;

/************************ begin BuiltValue boilerplate ************************/
factory ExtensionsNumBasesChange(Iterable<Extension> extensions, int num_bases) =>
ExtensionsNumBasesChange.from((b) => b
..extensions.replace(extensions)
..num_bases = num_bases);

factory ExtensionsNumBasesChange.from([void Function(ExtensionsNumBasesChangeBuilder) updates]) =
_$ExtensionsNumBasesChange;

ExtensionsNumBasesChange._();

static Serializer<ExtensionsNumBasesChange> get serializer => _$extensionsNumBasesChangeSerializer;

@override
String short_description() => "change extensions number of bases";
}

abstract class LoopoutLengthChange
with BuiltJsonSerializable, UndoableAction
implements StrandPartAction, Built<LoopoutLengthChange, LoopoutLengthChangeBuilder> {
Loopout get loopout;

int get length;
int get num_bases;

StrandPart get strand_part => loopout;

/************************ begin BuiltValue boilerplate ************************/
factory LoopoutLengthChange(Loopout loopout, int length) => LoopoutLengthChange.from((b) => b
factory LoopoutLengthChange(Loopout loopout, int num_bases) => LoopoutLengthChange.from((b) => b
..loopout.replace(loopout)
..length = length);
..num_bases = num_bases);

factory LoopoutLengthChange.from([void Function(LoopoutLengthChangeBuilder) updates]) =
_$LoopoutLengthChange;
Expand Down Expand Up @@ -3474,12 +3587,15 @@ abstract class StrandColorPickerHide
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// scaffold set/unset
// abstract supertype of actions that operate on a single strand

abstract class SingleStrandAction implements Action {
Strand get strand;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// scaffold set/unset

abstract class ScaffoldSet
with BuiltJsonSerializable, UndoableAction
implements SingleStrandAction, Built<ScaffoldSet, ScaffoldSetBuilder> {
Expand Down Expand Up @@ -3743,19 +3859,20 @@ abstract class ShowAxisArrowsSet
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// show or hide grid coordinates in side view
// show or hide loopout and extension lengths displayed next to the substrand

abstract class ShowLoopoutLengthSet
abstract class ShowLoopoutExtensionLengthSet
with BuiltJsonSerializable
implements Built<ShowLoopoutLengthSet, ShowLoopoutLengthSetBuilder> {
bool get show_loopout_length;
implements Built<ShowLoopoutExtensionLengthSet, ShowLoopoutExtensionLengthSetBuilder> {
bool get show_length;

/************************ begin BuiltValue boilerplate ************************/
factory ShowLoopoutLengthSet({bool show_loopout_length}) = _$ShowLoopoutLengthSet._;
factory ShowLoopoutExtensionLengthSet({bool show_length}) = _$ShowLoopoutExtensionLengthSet._;

ShowLoopoutLengthSet._();
ShowLoopoutExtensionLengthSet._();

static Serializer<ShowLoopoutLengthSet> get serializer => _$showLoopoutLengthSetSerializer;
static Serializer<ShowLoopoutExtensionLengthSet> get serializer =>
_$showLoopoutExtensionLengthSetSerializer;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
26 changes: 23 additions & 3 deletions lib/src/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const default_max_offset = 64;
final default_geometry = Geometry();

const scadnano_css_stylesheet_name_no_ext = r'scadnano-styles';
const scadnano_css_stylesheet_name = r'scadnano-styles.css';
const scadnano_css_stylesheet_name = '${scadnano_css_stylesheet_name_no_ext}.css';

const NUM_DIGITS_PRECISION_POSITION_DISPLAYED = 2;

Expand Down Expand Up @@ -165,6 +165,10 @@ const default_pitch = 0.0;
const default_yaw = 0.0;
//const default_helix_rotation_anchor = 0;

// for extensions
const default_display_angle = 35.0;
const default_display_length = 1.5;

const default_side_pane_width = '8%';

const default_group_name = 'default_group';
Expand Down Expand Up @@ -352,6 +356,19 @@ const loopout_keys = [
name_key,
];

// Extension keys
const extension_key = 'extension_num_bases';
const is_5p_key = 'is_5p';
const display_length_key = 'display_length';
const display_angle_key = 'display_angle';
const extension_keys = [
extension_key,
is_5p_key,
display_length_key,
display_angle_key,
label_key,
name_key,
];
////////////////////////////////////////////////////
/// svg-png-caching constants
Expand All @@ -367,7 +384,7 @@ const int DNA_SEQUENCE_VERTICAL_OFFSET = 50;
const int DNA_SEQUENCE_HORIZONTAL_OFFSET = 50;

// Zoom threshold used for caching the svg as png.
const num ZOOM_THRESHOLD = 1;
const num ZOOM_THRESHOLD = 0.5;

/////////////////////////////////////////////////////////////
// Backend
Expand All @@ -384,21 +401,24 @@ const css_selector_strand = 'strand';
const css_selector_scaffold = 'scaffold';
const css_selector_staple = 'staple';
const css_selector_domain = 'domain-line';
const css_selector_extension = 'extension-line';
const css_selector_crossover = 'crossover-curve';
const css_selector_loopout = 'loopout-curve';
const css_selector_end_5p_strand = 'five-prime-end-first-substrand';
const css_selector_end_3p_strand = 'three-prime-end-last-substrand';
const css_selector_end_5p_domain = 'five-prime-end';
const css_selector_end_3p_domain = 'three-prime-end';
const css_selector_end_parent_group = 'dna-ends';
const css_selector_loopout_length = 'loopout-length';
const css_selector_loopout_extension_length = 'loopout-extension-length';

const css_selector_domain_name = 'domain-name';
const css_selector_strand_name = 'strand-name';
const css_selector_domain_name_text = 'domain-name-text';
const css_selector_strand_name_text = 'strand-name-text';
const css_selector_loopout_name = 'loopout-name';
const css_selector_loopout_name_text = 'loopout-name-text';
const css_selector_extension_name = 'extension-name';
const css_selector_extension_name_text = 'extension-name-text';

const css_selector_domain_moving = 'domain-line-moving';
const css_selector_disallowed = 'disallowed';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/middleware/dna_ends_move_start.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import '../state/app_state.dart';
// it triggers a new action to be dispatched.
dna_ends_move_start_middleware(Store<AppState> store, action, NextDispatcher next) {
if (action is actions.DNAEndsMoveStart) {
BuiltSet<DNAEnd> selected_ends = store.state.ui_state.selectables_store.selected_dna_ends;
BuiltSet<DNAEnd> selected_ends = store.state.ui_state.selectables_store.selected_dna_ends_on_domains;
List<DNAEndMove> moves = [];
for (var end in selected_ends) {
int lowest_offset = find_allowable_offset(store.state.design, end, selected_ends, false);
Expand Down
Loading

0 comments on commit 979e64c

Please sign in to comment.