Skip to content

Commit 338fed3

Browse files
committed
also adjust for latex vertical align in tables
1 parent 3f6be1f commit 338fed3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Desktop/html/js/jaspwidgets.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ class SvgToPng {
3636
if (svgs.length > 0) {
3737
svgs.forEach(svg => {
3838
const canvas = document.createElement('canvas');
39-
const svgWidth = svg.width ? svg.width.baseVal.value : svg.getAttribute("width")
40-
const svgHeight = svg.height ? svg.height.baseVal.value : svg.getAttribute("Height")
39+
const svgWidth = svg.width ? svg.width.baseVal.value : svg.getAttribute("width");
40+
const svgHeight = svg.height ? svg.height.baseVal.value : svg.getAttribute("height");
41+
const svgDisplay = window.getComputedStyle(svg, null).display;
42+
const svgVerticalAlign = window.getComputedStyle(svg, null).verticalAlign;
4143
canvas.width = parseFloat(svgWidth) * 1.5;
4244
canvas.height = parseFloat(svgHeight) * 1.5;
4345
const img = new Image();
@@ -49,6 +51,8 @@ class SvgToPng {
4951
newImg.src = pngDataUrl;
5052
newImg.width = svgWidth;
5153
newImg.height = svgHeight;
54+
newImg.style.display = svgDisplay ? svgDisplay : "inline-block";
55+
newImg.style.verticalAlign = svgVerticalAlign ? svgVerticalAlign : "middle";
5256
if (svg.parentNode)
5357
svg.parentNode.replaceChild(newImg, svg);
5458
};

0 commit comments

Comments
 (0)