Remove deleted elements from svg export (#1021)

* Remove deleted elements from svg export

* skip deleted elements

* remove old comment

Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
Faustino Kialungila 2020-03-20 15:19:20 +01:00 committed by GitHub
parent 1546c00c0c
commit 0ad6f4ec6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -291,8 +291,6 @@ export async function exportCanvas(
if (!hasNonDeletedElements(elements)) { if (!hasNonDeletedElements(elements)) {
return window.alert(t("alerts.cannotExportEmptyCanvas")); return window.alert(t("alerts.cannotExportEmptyCanvas"));
} }
// calculate smallest area to fit the contents in
if (type === "svg") { if (type === "svg") {
const tempSvg = exportToSvg(elements, { const tempSvg = exportToSvg(elements, {
exportBackground, exportBackground,

View File

@ -289,12 +289,14 @@ export function renderSceneToSvg(
} }
// render elements // render elements
elements.forEach(element => { elements.forEach(element => {
renderElementToSvg( if (!element.isDeleted) {
element, renderElementToSvg(
rsvg, element,
svgRoot, rsvg,
element.x + offsetX, svgRoot,
element.y + offsetY, element.x + offsetX,
); element.y + offsetY,
);
}
}); });
} }