fix: proper background centering on scaled image

This commit is contained in:
Arnošt Pleskot 2023-08-23 14:05:03 +02:00
parent 7795d1aaef
commit ae8d62f5c9
No known key found for this signature in database

View File

@ -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,