From ae8d62f5c94014a7cad55425fc8ca824fd5c5c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arno=C5=A1t=20Pleskot?= Date: Wed, 23 Aug 2023 14:05:03 +0200 Subject: [PATCH] fix: proper background centering on scaled image --- src/scene/fancyBackground.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/scene/fancyBackground.ts b/src/scene/fancyBackground.ts index 66e36230b..9722ad291 100644 --- a/src/scene/fancyBackground.ts +++ b/src/scene/fancyBackground.ts @@ -100,9 +100,11 @@ const addContentBackground = ( context.shadowOffsetY = shadow.offsetY * exportScale; const x = - (normalizedDimensions.width - contentSize.width) / 2 - FANCY_BG_PADDING; + (normalizedDimensions.width - contentSize.width * exportScale) / 2 - + FANCY_BG_PADDING * exportScale; const y = - (normalizedDimensions.height - contentSize.height) / 2 - FANCY_BG_PADDING; + (normalizedDimensions.height - contentSize.height * exportScale) / 2 - + FANCY_BG_PADDING * exportScale; // fixme: position is no scaled to the center if (context.roundRect) { @@ -112,7 +114,7 @@ const addContentBackground = ( (contentSize.width + (DEFAULT_EXPORT_PADDING + FANCY_BG_BORDER_RADIUS) * 2) * exportScale, - (contentSize.height * exportScale + + (contentSize.height + (DEFAULT_EXPORT_PADDING + FANCY_BG_BORDER_RADIUS) * 2) * exportScale, FANCY_BG_BORDER_RADIUS * exportScale,