SVG export: add image size (#2292)
This commit is contained in:
parent
9de6c947ef
commit
5c26bd19d7
@ -302,6 +302,7 @@ export const exportCanvas = async (
|
|||||||
exportBackground,
|
exportBackground,
|
||||||
viewBackgroundColor,
|
viewBackgroundColor,
|
||||||
exportPadding,
|
exportPadding,
|
||||||
|
scale,
|
||||||
shouldAddWatermark,
|
shouldAddWatermark,
|
||||||
metadata:
|
metadata:
|
||||||
appState.exportEmbedScene && type === "svg"
|
appState.exportEmbedScene && type === "svg"
|
||||||
|
@ -83,11 +83,13 @@ export const exportToSvg = (
|
|||||||
exportBackground,
|
exportBackground,
|
||||||
exportPadding = 10,
|
exportPadding = 10,
|
||||||
viewBackgroundColor,
|
viewBackgroundColor,
|
||||||
|
scale = 1,
|
||||||
shouldAddWatermark,
|
shouldAddWatermark,
|
||||||
metadata = "",
|
metadata = "",
|
||||||
}: {
|
}: {
|
||||||
exportBackground: boolean;
|
exportBackground: boolean;
|
||||||
exportPadding?: number;
|
exportPadding?: number;
|
||||||
|
scale?: number;
|
||||||
viewBackgroundColor: string;
|
viewBackgroundColor: string;
|
||||||
shouldAddWatermark: boolean;
|
shouldAddWatermark: boolean;
|
||||||
metadata?: string;
|
metadata?: string;
|
||||||
@ -106,6 +108,8 @@ export const exportToSvg = (
|
|||||||
svgRoot.setAttribute("version", "1.1");
|
svgRoot.setAttribute("version", "1.1");
|
||||||
svgRoot.setAttribute("xmlns", SVG_NS);
|
svgRoot.setAttribute("xmlns", SVG_NS);
|
||||||
svgRoot.setAttribute("viewBox", `0 0 ${width} ${height}`);
|
svgRoot.setAttribute("viewBox", `0 0 ${width} ${height}`);
|
||||||
|
svgRoot.setAttribute("width", `${width * scale}`);
|
||||||
|
svgRoot.setAttribute("height", `${height * scale}`);
|
||||||
|
|
||||||
svgRoot.innerHTML = `
|
svgRoot.innerHTML = `
|
||||||
${SVG_EXPORT_TAG}
|
${SVG_EXPORT_TAG}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user