delph-in / delphin-viz

JavaScript visualizations of various DELPH-IN structures.

Home Page:http://delph-in.github.io/delphin-viz/demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PNG and SVG saving clips MRS and DMRS structures

goodmami opened this issue · comments

Both MRS and DMRS visualizations get clipped when saved to SVG or PNG. More specifically, DMRS only gets clipped with PNG, and the SVG for MRS isn't really clipped, but there is 0 margin to the right of the large square opening bracket (unlike the opening bracket on the left).

See #2; the example there is relevant for reproducing these issues.

@ned2 I pushed a commit that replaces getBBox() with getBoundingClientRect(). It seems there was already a call to getBoundingClientRect() in the saveVizPng() function, but it wasn't used, so maybe someone was just testing it. Do you recall why we didn't switch before? In my tests in Firefox and Chrome on Linux, the other function gets the computed bounding box considering transforms, text anchors, etc., so now it doesn't clip the PNG for me for DMRSs. It doesn't seem to change much for MRSs, though, but I think there's something else going on there because sometimes the right bracket isn't displayed in the SVG in the browser, either. If you have no objections I think this issue can be closed, too.

Thanks for the fix! I don't recall why we didn't already switch I'm afraid. Happy to close yes :)

Great, thanks, Ned!