UC-Davis-molecular-computing / scadnano

Web application for designing DNA structures such as DNA origami.
https://scadnano.org
MIT License
21 stars 13 forks source link

save SVG file with image of selected objects #887

Closed dave-doty closed 11 months ago

dave-doty commented 12 months ago

This is related to #740. That feature seems very difficult to implement due to browser security restrictions about what types of data can be put on the system clipboard.

This issue is a workaround that is slightly more work to use, but avoids the need to work with the system clipboard. Here, we want to save an SVG file. This is similar to what happens when selecting Export-->SVG main view, but the difference is that this will make an SVG file out of only the selected objects (the same as what is currently implemented in PR #769), not the entire main view.

This should be straightforward to implement by combining the logic of collecting the selected object SVG, along with the existing logic from saving SVG files.

This should be a new menu item Export-->SVG of selected objects.

abhishekgokhale commented 12 months ago

Code to close this issue has been pushed, however, I have based the branch from the branch for #740 since there was similar code for both of them. I will make the PR for this branch once this #769 PR is approved and merged, so then the basing would technically be from dev.

dave-doty commented 11 months ago

Go ahead and merge #769 if it looks good.

abhishekgokhale commented 11 months ago

Need approval to merge #769. Can you approve it so that I can go ahead and create this PR as well? Thanks!

dave-doty commented 11 months ago

Done

dave-doty commented 11 months ago

Release notes

Export SVG file of selected strands

Previously it was only possible to export the entire main view (view of all strands and helices). Now, you can select some strands and export only them:

image

Which saves this SVG file:

image

There is a separate feature (https://github.com/UC-Davis-molecular-computing/scadnano/issues/740) in which selected strands can be copied into an image in the system clipboard and pasted into other programs, such as Powerpoint or Inkscape. However, this is not a SVG image, it is a PNG (bitmap) image that will be pixelated on zoom-in:

image

It takes more takes more work to use "Export-->SVG of selected strands" for such transferring of images (since you have to save a file, then import that file into the other program), but retains the vector graphics that remain sharp when zoomed in.