Skip to content

Commit

Permalink
fixed diagram to image exporting
Browse files Browse the repository at this point in the history
  • Loading branch information
ishubin committed Nov 11, 2023
1 parent 9bf8b87 commit 07da72d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/ui/diagramExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,15 @@ export function diagramImageExporter(items) {
svg.setAttribute('xmlns:xhtml', "http://www.w3.org/1999/xhtml");
svg.setAttribute('xmlns:xlink', "http://www.w3.org/1999/xlink");
svg.setAttribute('viewBox', `${-paddingLeft} ${-paddingTop} ${box.w + paddingLeft} ${box.h + paddingTop}`);
svg.setAttribute('preserveAspectRatio', 'xMinYMin');
svg.setAttribute('width', `${box.w}px`);
svg.setAttribute('height', `${box.h}px`);
svg.setAttribute('preserveAspectRatio', 'xMidYMid');
svg.setAttribute('width', `${imageWidth}px`);
svg.setAttribute('height', `${imageHeight}px`);

return rasterizeAllImagesToDataURL(svg)
.then(() => svgToImage(svg.outerHTML, imageWidth, imageHeight, paddingLeft, paddingTop, backgroundColor));
.then(() => {
console.log(svg.outerHTML);
return svgToImage(svg.outerHTML, imageWidth, imageHeight, paddingLeft, paddingTop, backgroundColor);
});
}
};
}

0 comments on commit 07da72d

Please sign in to comment.