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 679c800
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 = svg.style.display ? svg.style.display : "inline-block";
const svgverticalAlign = svg.style.verticalAlign ? svg.style.verticalAlign : "middle";
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;
newImg.style.verticalAlign = svgverticalAlign;
if (svg.parentNode)
svg.parentNode.replaceChild(newImg, svg);
};
Expand Down

0 comments on commit 679c800

Please sign in to comment.