Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

895 export base pair lines #955

Merged
merged 6 commits into from
Dec 21, 2023
Merged

895 export base pair lines #955

merged 6 commits into from
Dec 21, 2023

Conversation

rayzhuca
Copy link
Member

Added export SVG support for base pair lines.

Changes

  • Removed the old method of creating a separate method to filter selected base pairs as suggested.
  • Modified _base_pairs(bool allow_mismatches) to _base_pairs(bool allow_mismatches, BuiltSet<Strand> selected_strands). Now base_pairs is this._base_pairs(false, strands.toBuiltSet()) and selected_base_pairs(BuiltSet<Strand> selected_strands) just calls _base_pairs directly.
  • For each base pair, I added an id base_pair-{helix-id}-{offset} so we can identify the base pairs that is in selected_base_pairs.
  • Created a new method List<Element> get_selected_base_pairs(Store<AppState> store) that mirrors the behavior of List<Element> get_selected_strands(Store<AppState> store) so that it adds the base pair HTML elements into the exported SVG.

@rayzhuca rayzhuca added the enhancement New feature or request label Nov 12, 2023
Copy link
Member

@dave-doty dave-doty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why, but it's not working for me when copying a PNG image. I create this design:

image

Then select and copy image:

image

But when I paste into Powerpoint, no base pair lines:

image

It does work if I Export an SVG file:

image

Open the SVG file in Inkscape:

image

I suspect it would help to refactor the code exporting selected strands to SVG and to PNG to share more code, so that if one gets fixed so does the other.

@rayzhuca
Copy link
Member Author

It should work now. It was a quick fix. In export_svg_middleware, there is an if statement. One branch is for ExportSvg and another is CopySelectedStandsToClipboardImage. I just had to call get_selected_base_pairs in both branches.

@rayzhuca
Copy link
Member Author

The new commit renamed get_selected_strands and get_selected_base_pairs to get_svg_elements_of_strands and get_svg_elements_of_base_pairs as well as changes to function arguments. I also removed the long one-line and refactored two pieces of repeated of code into one function called get_selected_svg_elements.

Copy link
Member

@dave-doty dave-doty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why I didn't approve this last month. I'll approve it for now since it seems to look okay, hopefully there's not something I missed that needs to be done still.

@rayzhuca rayzhuca merged commit 5d4cc56 into dev Dec 21, 2023
4 checks passed
@dave-doty dave-doty deleted the 895-export-base-pair-lines branch December 22, 2023 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

export base pair lines in *Export-->SVG of selected strands* and *Edit-->Copy image*
2 participants