From 5c26bd19d7c2ad3f44eb621bb8f231e7c59480a0 Mon Sep 17 00:00:00 2001 From: Geraint Date: Wed, 28 Oct 2020 17:10:22 +0000 Subject: [PATCH] SVG export: add image size (#2292) --- src/data/index.ts | 1 + src/scene/export.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/data/index.ts b/src/data/index.ts index f0e1d8e6..9df28cc3 100644 --- a/src/data/index.ts +++ b/src/data/index.ts @@ -302,6 +302,7 @@ export const exportCanvas = async ( exportBackground, viewBackgroundColor, exportPadding, + scale, shouldAddWatermark, metadata: appState.exportEmbedScene && type === "svg" diff --git a/src/scene/export.ts b/src/scene/export.ts index c623552d..cce93b5c 100644 --- a/src/scene/export.ts +++ b/src/scene/export.ts @@ -83,11 +83,13 @@ export const exportToSvg = ( exportBackground, exportPadding = 10, viewBackgroundColor, + scale = 1, shouldAddWatermark, metadata = "", }: { exportBackground: boolean; exportPadding?: number; + scale?: number; viewBackgroundColor: string; shouldAddWatermark: boolean; metadata?: string; @@ -106,6 +108,8 @@ export const exportToSvg = ( svgRoot.setAttribute("version", "1.1"); svgRoot.setAttribute("xmlns", SVG_NS); svgRoot.setAttribute("viewBox", `0 0 ${width} ${height}`); + svgRoot.setAttribute("width", `${width * scale}`); + svgRoot.setAttribute("height", `${height * scale}`); svgRoot.innerHTML = ` ${SVG_EXPORT_TAG}