Skip to content

Commit

Permalink
also adjust for latex vertical align in tables
Browse files Browse the repository at this point in the history
  • Loading branch information
shun2wang committed Feb 21, 2025
1 parent 3f6be1f commit 338fed3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Desktop/html/js/jaspwidgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ class SvgToPng {
if (svgs.length > 0) {
svgs.forEach(svg => {
const canvas = document.createElement('canvas');
const svgWidth = svg.width ? svg.width.baseVal.value : svg.getAttribute("width")
const svgHeight = svg.height ? svg.height.baseVal.value : svg.getAttribute("Height")
const svgWidth = svg.width ? svg.width.baseVal.value : svg.getAttribute("width");
const svgHeight = svg.height ? svg.height.baseVal.value : svg.getAttribute("height");
const svgDisplay = window.getComputedStyle(svg, null).display;
const svgVerticalAlign = window.getComputedStyle(svg, null).verticalAlign;
canvas.width = parseFloat(svgWidth) * 1.5;
canvas.height = parseFloat(svgHeight) * 1.5;
const img = new Image();
Expand All @@ -49,6 +51,8 @@ class SvgToPng {
newImg.src = pngDataUrl;
newImg.width = svgWidth;
newImg.height = svgHeight;
newImg.style.display = svgDisplay ? svgDisplay : "inline-block";
newImg.style.verticalAlign = svgVerticalAlign ? svgVerticalAlign : "middle";
if (svg.parentNode)
svg.parentNode.replaceChild(newImg, svg);
};
Expand Down

0 comments on commit 338fed3

Please sign in to comment.