From 8b9dd3c4226e4c5b097d056ec1c463cd7d3d85c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arno=C5=A1t=20Pleskot?= Date: Wed, 20 Sep 2023 17:25:19 +0200 Subject: [PATCH] docs: couple of comments --- src/scene/fancyBackground.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/scene/fancyBackground.ts b/src/scene/fancyBackground.ts index 4e1794b75..9dfd86e86 100644 --- a/src/scene/fancyBackground.ts +++ b/src/scene/fancyBackground.ts @@ -27,6 +27,7 @@ export const getFancyBackgroundPadding = ( ], includeLogo = false, ): ExportPadding => + // for stretched background we need to add same padding to all sides FANCY_BG_STRETCH_CONTENT_BACKGROUND ? (exportPadding.map( (padding) => @@ -35,7 +36,8 @@ export const getFancyBackgroundPadding = ( FANCY_BG_BORDER_RADIUS + padding, ) as [number, number, number, number]) - : (exportPadding.map( + : // otherwise we need to add padding to all sides except bottom where we need to add extra space when is presented logo + (exportPadding.map( (padding, index) => FANCY_BG_PADDING + FANCY_BG_BORDER_RADIUS + @@ -99,6 +101,7 @@ const getContentBackgound = ( exportScale: number, includeLogo: boolean, ): { x: number; y: number; width: number; height: number } => { + // When the content backgrond should be stretched it is taken as canvas size - padding if (FANCY_BG_STRETCH_CONTENT_BACKGROUND) { const padding = FANCY_BG_PADDING + FANCY_BG_LOGO_PADDING; @@ -110,6 +113,7 @@ const getContentBackgound = ( }; } + // Otherwise the content background is taken as content size + padding and centered and adjust for logo const totalPaddingAndRadius = DEFAULT_EXPORT_PADDING + FANCY_BG_BORDER_RADIUS; const width =