docs: couple of comments

This commit is contained in:
Arnošt Pleskot 2023-09-20 17:25:19 +02:00
parent 9f17998427
commit 8b9dd3c422
No known key found for this signature in database

View File

@ -27,6 +27,7 @@ export const getFancyBackgroundPadding = (
], ],
includeLogo = false, includeLogo = false,
): ExportPadding => ): ExportPadding =>
// for stretched background we need to add same padding to all sides
FANCY_BG_STRETCH_CONTENT_BACKGROUND FANCY_BG_STRETCH_CONTENT_BACKGROUND
? (exportPadding.map( ? (exportPadding.map(
(padding) => (padding) =>
@ -35,7 +36,8 @@ export const getFancyBackgroundPadding = (
FANCY_BG_BORDER_RADIUS + FANCY_BG_BORDER_RADIUS +
padding, padding,
) as [number, number, number, number]) ) 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) => (padding, index) =>
FANCY_BG_PADDING + FANCY_BG_PADDING +
FANCY_BG_BORDER_RADIUS + FANCY_BG_BORDER_RADIUS +
@ -99,6 +101,7 @@ const getContentBackgound = (
exportScale: number, exportScale: number,
includeLogo: boolean, includeLogo: boolean,
): { x: number; y: number; width: number; height: number } => { ): { 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) { if (FANCY_BG_STRETCH_CONTENT_BACKGROUND) {
const padding = FANCY_BG_PADDING + FANCY_BG_LOGO_PADDING; 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 totalPaddingAndRadius = DEFAULT_EXPORT_PADDING + FANCY_BG_BORDER_RADIUS;
const width = const width =