Open SimonEnsemble opened 2 years ago
Merging #70 (12679ba) into master (00c880e) will decrease coverage by
0.08%
. The diff coverage is10.00%
.
@@ Coverage Diff @@
## master #70 +/- ##
==========================================
- Coverage 76.14% 76.05% -0.09%
==========================================
Files 56 56
Lines 4963 4970 +7
==========================================
+ Hits 3779 3780 +1
- Misses 1184 1190 +6
Impacted Files | Coverage Δ | |
---|---|---|
src/draw/svg.jl | 73.43% <0.00%> (-2.07%) |
:arrow_down: |
src/draw/draw2d.jl | 75.32% <50.00%> (ø) |
|
src/draw/draw3d.jl | 97.82% <0.00%> (+2.17%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 00c880e...12679ba. Read the comment docs.
Thank you very much. That looks great!
I'm not sure about the way to fit the anchor and the size of text
and rect
in SVG.
This positioning system may depend on the font size and the number of characters and seems to be complicated...
I'd be happy if you post it as a new issue.
Or, bxy = svgcoords(pos - (size / 2, size / 2))
may work like setatomhighlight!
below.
The anchor seems to be OK. The centering should be,
x
value of text
tag ((rect size - text width) / 2).transform="translate(xpos, ypos)"
in g
tag and text-anchor="middle"
in text
would be better.
From
<g>
<rect x="186.73" y="152.98" width="10" height="10" rx="5.0" ry="5.0" fill="rgb(240, 240, 255)"></rect>
<text x="186.73" y="162.98" font-size="10" fill="rgb(0, 0, 0)">5</text>
</g>
To
<g width="10" height="10" transform="translate(186.73, 152.98)">
<rect width="10" height="10" rx="5.0" ry="5.0" fill="rgb(240, 240, 255)"></rect>
<text x="5" y="10" font-size="10" fill="rgb(0, 0, 0)" text-anchor="middle">5</text>
</g>
text.x value is a half of g.width
g.width is still environment dependent. (font-size / 2 * word count) would be a good guess.
based on here, felt like this would work, but it doesn't. :(
elem = """<g transform="translate($(pos.x), $(pos.y))">
<rect x="0" y="0" width="$(size)" height="$(size)" rx="$(size/2)" ry="$(size/2)" fill="$(bc)" opacity="$(opacity)" />
<text x="$(size/2)" y="$(size/2)" font-size="$(size)" fill="$(c)" text-anchor="middle" alignment-baseline="middle">$(text) </text>
</g>
"""
The attribute name would be fill-opacity
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-opacity
and text.y may be y="$(size)"
.
one thing I couldn't figure out: the atom indices are not centered with the circles behind them. there is an offset. how can I fix this? https://github.com/mojaie/MolecularGraph.jl/blob/master/src/draw/svg.jl#L334-L335 some change here?
here is my test for this: