From 7795d1aaefa379810a449e8a77f6a8d61a52de2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arno=C5=A1t=20Pleskot?= Date: Wed, 23 Aug 2023 00:50:40 +0200 Subject: [PATCH] feat: solid background position in roundRect fallback --- src/scene/fancyBackground.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/scene/fancyBackground.ts b/src/scene/fancyBackground.ts index 34f226cd6..66e36230b 100644 --- a/src/scene/fancyBackground.ts +++ b/src/scene/fancyBackground.ts @@ -104,6 +104,7 @@ const addContentBackground = ( const y = (normalizedDimensions.height - contentSize.height) / 2 - FANCY_BG_PADDING; + // fixme: position is no scaled to the center if (context.roundRect) { context.roundRect( x, @@ -119,10 +120,14 @@ const addContentBackground = ( } else { roundRect( context, - FANCY_BG_PADDING * exportScale, - FANCY_BG_PADDING * exportScale, - normalizedDimensions.width - FANCY_BG_PADDING * 2 * exportScale, - normalizedDimensions.height - FANCY_BG_PADDING * 2 * exportScale, + x, + y, + (contentSize.width + + (DEFAULT_EXPORT_PADDING + FANCY_BG_BORDER_RADIUS) * 2) * + exportScale, + (contentSize.height * exportScale + + (DEFAULT_EXPORT_PADDING + FANCY_BG_BORDER_RADIUS) * 2) * + exportScale, FANCY_BG_BORDER_RADIUS * exportScale, ); }