fix export
This commit is contained in:
parent
4c2824c484
commit
dbaa13ab97
@ -12,7 +12,6 @@ import {
|
|||||||
updateImageCache,
|
updateImageCache,
|
||||||
} from "../element/image";
|
} from "../element/image";
|
||||||
import Scene from "./Scene";
|
import Scene from "./Scene";
|
||||||
import { isVisibleElement } from "../element/sizeHelpers";
|
|
||||||
|
|
||||||
export const SVG_EXPORT_TAG = `<!-- svg-source:excalidraw -->`;
|
export const SVG_EXPORT_TAG = `<!-- svg-source:excalidraw -->`;
|
||||||
|
|
||||||
@ -55,31 +54,15 @@ export const exportToCanvas = async (
|
|||||||
|
|
||||||
const onlyExportingSingleFrame = isOnlyExportingSingleFrame(elements);
|
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({
|
renderStaticScene({
|
||||||
canvas,
|
canvas,
|
||||||
rc: rough.canvas(canvas),
|
rc: rough.canvas(canvas),
|
||||||
elements,
|
elements,
|
||||||
visibleElements,
|
visibleElements: elements,
|
||||||
scale,
|
scale,
|
||||||
appState: {
|
appState: {
|
||||||
...appState,
|
...appState,
|
||||||
|
viewBackgroundColor: exportBackground ? viewBackgroundColor : null,
|
||||||
scrollX: -minX + (onlyExportingSingleFrame ? 0 : exportPadding),
|
scrollX: -minX + (onlyExportingSingleFrame ? 0 : exportPadding),
|
||||||
scrollY: -minY + (onlyExportingSingleFrame ? 0 : exportPadding),
|
scrollY: -minY + (onlyExportingSingleFrame ? 0 : exportPadding),
|
||||||
zoom: defaultAppState.zoom,
|
zoom: defaultAppState.zoom,
|
||||||
|
@ -124,7 +124,7 @@ export type CommonCanvasAppState = {
|
|||||||
export type StaticCanvasAppState = CommonCanvasAppState & {
|
export type StaticCanvasAppState = CommonCanvasAppState & {
|
||||||
shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
|
shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
|
||||||
/** null indicates transparent bg */
|
/** null indicates transparent bg */
|
||||||
viewBackgroundColor?: AppState["viewBackgroundColor"];
|
viewBackgroundColor: AppState["viewBackgroundColor"] | null;
|
||||||
exportScale: AppState["exportScale"];
|
exportScale: AppState["exportScale"];
|
||||||
selectedElementsAreBeingDragged: AppState["selectedElementsAreBeingDragged"];
|
selectedElementsAreBeingDragged: AppState["selectedElementsAreBeingDragged"];
|
||||||
gridSize: AppState["gridSize"];
|
gridSize: AppState["gridSize"];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user