feat: center and scale solid background on top of fancyBackground

This commit is contained in:
Arnošt Pleskot 2023-08-23 00:42:31 +02:00
parent e00764a937
commit 38fd4fb165
No known key found for this signature in database
2 changed files with 24 additions and 10 deletions

View file

@ -89,20 +89,21 @@ export const exportToCanvas = async (
exportWithFancyBackground &&
appState.fancyBackgroundImageKey !== "solid"
) {
const commonBounds = getCommonBounds(elements);
const contentSize: Dimensions = {
width: distance(commonBounds[0], commonBounds[2]),
height: distance(commonBounds[1], commonBounds[3]),
};
await applyFancyBackgroundOnCanvas({
canvas,
fancyBackgroundImageKey: appState.fancyBackgroundImageKey,
backgroundColor: viewBackgroundColor,
exportScale: scale,
theme: appState.exportWithDarkMode ? THEME.DARK : THEME.LIGHT,
contentSize,
});
const commonBounds = getCommonBounds(elements);
const contentSize: Dimensions = {
width: distance(commonBounds[0], commonBounds[2]),
height: distance(commonBounds[1], commonBounds[3]),
};
scrollXAdjustment = (width - contentSize.width - padding * 2) / 2;
scrollYAdjustment = (height - contentSize.height - padding * 2) / 2;
}