UC-Davis-molecular-computing / scadnano

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

display extension name right-side-up #961

Open dave-doty opened 9 months ago

dave-doty commented 9 months ago

It was originally implemented this way, but also erroneously caused the DNA sequence of the extension to display backwards. See #959.

I made the call to quick-fix the DNA sequence issue, since it could lead to errors in DNA sequences if someone mistakenly reversed their DNA sequence to make it look "correct" in scadnano. The way I fixed it was to always draw the extension line starting at the 5' end and ending at the 3' end.

Previously, we drew it starting at the left and ending at the right, which makes textPath's tied to the line always display above it. So now extension names (and labels) appear like this:

image

Let's figure out a way to make the upside-down names and labels appear right-side-up, while preserving the correct display of DNA sequences:

image

dave-doty commented 9 months ago

I think the straightforward fix for this is, in DesignMainExtension, to draw a second invisible line along with the visible extension line, but use the original left-to-right order, instead of 5' to 3' order, and then set xlinkHref in DesignMainStrandExtensionText to that invisible line for the extension name and label instead of the visible extension line.

UPDATE: It might be simpler to do the following. Check if the 3' end of the extension is to the left (has a smaller x coordinate) than the 5' end (implicitly, by checking the fields Extension.display_length and Extension.display_angle), and if so draw the line left to right (i.e., 3' to 5' in this case), render the DNA as before, but render the reverse of the original DNA sequence.