Skip to content

Commit c7a0de6

Browse files
fix(export): png export fails if legend disabled
1 parent e975e0b commit c7a0de6

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/renderer/src/lib/ExportModal.svelte

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,16 @@
158158
},
159159
);
160160
161-
const legendImageUrl = await convertSvgToPng(legendTarget.firstChild as SVGElement, {
162-
left: 0,
163-
top: 0,
164-
width: (1000 * imageWidth) / imageHeight,
165-
height: 1000,
166-
outputWidth: imageWidth,
167-
outputHeight: imageHeight,
168-
}).then(convertBlobToDataUrl);
161+
const legendImageUrl = $mapSettings.legend
162+
? await convertSvgToPng(legendTarget.firstChild as SVGElement, {
163+
left: 0,
164+
top: 0,
165+
width: (1000 * imageWidth) / imageHeight,
166+
height: 1000,
167+
outputWidth: imageWidth,
168+
outputHeight: imageHeight,
169+
}).then(convertBlobToDataUrl)
170+
: undefined;
169171
170172
const buffer = await convertSvgToPng(
171173
solarSystemMap ? (solarSystemMapTarget.firstChild as SVGElement) : galaxyMapSvg,

0 commit comments

Comments
 (0)