fix: preview size when maxWidthOrHeight is hit

This commit is contained in:
Arnošt Pleskot 2023-08-23 16:03:09 +02:00
parent ae8d62f5c9
commit a76aa5f7a1
No known key found for this signature in database
2 changed files with 15 additions and 5 deletions

View File

@ -186,11 +186,7 @@ const ImageExportModal = ({
appState, appState,
files, files,
exportPadding: DEFAULT_EXPORT_PADDING, exportPadding: DEFAULT_EXPORT_PADDING,
maxWidthOrHeight: !( maxWidthOrHeight,
exportBackgroundImage !== "solid" && exportWithBackground
)
? maxWidthOrHeight
: undefined,
}) })
.then((canvas) => { .then((canvas) => {
setRenderError(null); setRenderError(null);

View File

@ -70,6 +70,20 @@ export const exportToCanvas = ({
(width: number, height: number) => { (width: number, height: number) => {
const canvas = document.createElement("canvas"); const canvas = document.createElement("canvas");
if (
appState?.exportBackground &&
appState?.fancyBackgroundImageKey !== "solid"
) {
const scale = appState?.exportScale ?? 1;
canvas.width = width * scale;
canvas.height = height * scale;
return {
canvas,
scale,
};
}
if (maxWidthOrHeight) { if (maxWidthOrHeight) {
if (typeof getDimensions === "function") { if (typeof getDimensions === "function") {
console.warn( console.warn(