ソースを参照

fix: proper background centering on scaled image

Arnošt Pleskot 2 年 前
コミット
ae8d62f5c9
1 ファイル変更5 行追加3 行削除
  1. 5 3
      src/scene/fancyBackground.ts

+ 5 - 3
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,