Skip to content

Commit

Permalink
fix(export): png export fails if legend disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMakesGames committed Sep 18, 2024
1 parent e975e0b commit c7a0de6
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/renderer/src/lib/ExportModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,16 @@
},
);
const legendImageUrl = await convertSvgToPng(legendTarget.firstChild as SVGElement, {
left: 0,
top: 0,
width: (1000 * imageWidth) / imageHeight,
height: 1000,
outputWidth: imageWidth,
outputHeight: imageHeight,
}).then(convertBlobToDataUrl);
const legendImageUrl = $mapSettings.legend
? await convertSvgToPng(legendTarget.firstChild as SVGElement, {
left: 0,
top: 0,
width: (1000 * imageWidth) / imageHeight,
height: 1000,
outputWidth: imageWidth,
outputHeight: imageHeight,
}).then(convertBlobToDataUrl)
: undefined;
const buffer = await convertSvgToPng(
solarSystemMap ? (solarSystemMapTarget.firstChild as SVGElement) : galaxyMapSvg,
Expand Down

0 comments on commit c7a0de6

Please sign in to comment.