Kappa-Dev / KappaTools

Tool suite for kappa models. Documentation and binaries can be found in the release section. Try it online at
http://kappalanguage.org/
GNU Lesser General Public License v3.0
113 stars 41 forks source link

GUI double-prints CM bonds into SVG, with black fill #606

Open hmedina opened 5 years ago

hmedina commented 5 years ago

When exporting a contact map as an SVG (Firefox 69.0.1): 1) Some bonds are output twice 2) Bonds have a fill value of black, instead of having no fill

For example, given the model:

%agent: A(a,b)
A(a[./1]), A(b[./1]) @ 1

The exported CM looks like: Annotation 2019-09-26 164707

Notice that the layer view displays two <Path> elements.

pirbo commented 5 years ago

I cannot reproduce the filling part! Your example works well on my firefox... (I agree about the 2 paths, I'll see if I see something obvious)

hmedina commented 5 years ago

Using both Firefox and Chrome, I produce the same behavior: two times the bond. When viewed in Illustrator, it has black fill. When viewed by Chrome or Firefox, it does not. So there is an issue of viewer interpretation happening, which hinted to non-standard SVG.

For the black fill:

From https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill the value of a Fill attribute must be a Paint type, which from https://www.w3.org/TR/SVG/painting.html#SpecifyingPaint does not list "transparent" as an option. If I switch to "none", the issue goes away, with Illustrator, Chrome, and Firefox displaying the line with no fill. I suspect l.249 of render-contactmap.js should be switched to none rather than the current transparent (but can't test at the moment..)

For the double printing:

The lines are not identical if one inspects the SVG source. These paths of class "link" have different values for their d= attribute, which means they are technically different. On one file, the beginning of two looks like:

d="
M 255.16666666666663, -1.5624452079121645e-14
L 239.92754629629624, -1.449601942896286e-14 [...]

and

d="
M -255.16666666666663, 4.6873356237364935e-14
L -239.92754629629624, 4.426928089084467e-14 [...]

Notice the start position for the Move command has opposite X coordinate, and the Y coordinate has an exponent of -14. The second command, Line, also has an opposite X coordinate, and a Y coordinate of essentially zero. Is the double-printing arising out of printing the bond from A.a to A.b, and then another one from A.b back to A.a ?