feat: constrain export dialog preview size (#6475)

This commit is contained in:
David Luzar 2023-04-18 15:27:51 +02:00 committed by GitHub
parent 801412bf6b
commit 4d0d844e39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 14 deletions

View file

@ -79,7 +79,11 @@ export const exportToCanvas = ({
const max = Math.max(width, height);
const scale = maxWidthOrHeight / max;
// if content is less then maxWidthOrHeight, fallback on supplied scale
const scale =
maxWidthOrHeight < max
? maxWidthOrHeight / max
: appState?.exportScale ?? 1;
canvas.width = width * scale;
canvas.height = height * scale;