From dbaa13ab97a950a611e8916f17af25d070606f31 Mon Sep 17 00:00:00 2001 From: dwelle Date: Sun, 6 Aug 2023 13:47:30 +0200 Subject: [PATCH] fix export --- src/scene/export.ts | 21 ++------------------- src/types.ts | 2 +- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/src/scene/export.ts b/src/scene/export.ts index 7f7433b47..ca838f053 100644 --- a/src/scene/export.ts +++ b/src/scene/export.ts @@ -12,7 +12,6 @@ import { updateImageCache, } from "../element/image"; import Scene from "./Scene"; -import { isVisibleElement } from "../element/sizeHelpers"; export const SVG_EXPORT_TAG = ``; @@ -55,31 +54,15 @@ export const exportToCanvas = async ( const onlyExportingSingleFrame = isOnlyExportingSingleFrame(elements); - const viewTransformations = { - zoom: appState.zoom, - offsetLeft: appState.offsetLeft, - offsetTop: appState.offsetTop, - scrollX: appState.scrollX, - scrollY: appState.scrollY, - }; - - const visibleElements = elements.filter((element) => - isVisibleElement( - element, - appState.width, - appState.height, - viewTransformations, - ), - ); - renderStaticScene({ canvas, rc: rough.canvas(canvas), elements, - visibleElements, + visibleElements: elements, scale, appState: { ...appState, + viewBackgroundColor: exportBackground ? viewBackgroundColor : null, scrollX: -minX + (onlyExportingSingleFrame ? 0 : exportPadding), scrollY: -minY + (onlyExportingSingleFrame ? 0 : exportPadding), zoom: defaultAppState.zoom, diff --git a/src/types.ts b/src/types.ts index 6988e19d5..e6158256c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -124,7 +124,7 @@ export type CommonCanvasAppState = { export type StaticCanvasAppState = CommonCanvasAppState & { shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"]; /** null indicates transparent bg */ - viewBackgroundColor?: AppState["viewBackgroundColor"]; + viewBackgroundColor: AppState["viewBackgroundColor"] | null; exportScale: AppState["exportScale"]; selectedElementsAreBeingDragged: AppState["selectedElementsAreBeingDragged"]; gridSize: AppState["gridSize"];