From c7a0de6ba45fe2fcf94f377ef3fb8f16eb46a804 Mon Sep 17 00:00:00 2001 From: Michael Moore Date: Tue, 17 Sep 2024 22:19:54 -0500 Subject: [PATCH] fix(export): png export fails if legend disabled --- src/renderer/src/lib/ExportModal.svelte | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/renderer/src/lib/ExportModal.svelte b/src/renderer/src/lib/ExportModal.svelte index 2b48658..90ffb03 100644 --- a/src/renderer/src/lib/ExportModal.svelte +++ b/src/renderer/src/lib/ExportModal.svelte @@ -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,