SVG export: add image size (#2292)

This commit is contained in:
Geraint 2020-10-28 17:10:22 +00:00 committed by GitHub
parent 9de6c947ef
commit 5c26bd19d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -302,6 +302,7 @@ export const exportCanvas = async (
exportBackground,
viewBackgroundColor,
exportPadding,
scale,
shouldAddWatermark,
metadata:
appState.exportEmbedScene && type === "svg"

View File

@ -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}