Skip to content

Commit

Permalink
fixed crash bug in displaying only selected helices
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-doty committed Feb 4, 2022
1 parent 1e2d52a commit 9b82855
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/src/view/design_main_strand.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,19 @@ class DesignMainStrandComponent extends UiComponent2<DesignMainStrandProps>

// only store enough of helix svg positions for helices this strand has
Map<int, Point<num>> helix_idx_to_svg_position_y_map_on_strand_unbuilt = {};
var helix_idx_to_svg_position_map = props.helix_idx_to_svg_position_map;
for (var domain in props.strand.domains) {
helix_idx_to_svg_position_y_map_on_strand_unbuilt[domain.helix] =
props.helix_idx_to_svg_position_map[domain.helix];
int helix_idx = domain.helix;
if (props.side_selected_helix_idxs == null || props.side_selected_helix_idxs.contains(helix_idx)) {
// If props.side_selected_helix_idxs == null, then we are displaying all helices and need to
// include this helix. Otherwise we are not displaying unselected helices.
// In that case if props.side_selected_helix_idxs.contains(helix_idx) is false,
// then helix_idx will not even be in helix_idx_to_svg_position_map.
// since the memoized getter for AppState.helix_idx_to_svg_position_map skips it.
// But we won't need it anyway in that case.
var svg_pos = helix_idx_to_svg_position_map[helix_idx];
helix_idx_to_svg_position_y_map_on_strand_unbuilt[domain.helix] = svg_pos;
}
}
BuiltMap<int, Point<num>> helix_idx_to_svg_position_y_map_on_strand =
helix_idx_to_svg_position_y_map_on_strand_unbuilt.build();
Expand Down

0 comments on commit 9b82855

Please sign in to comment.