feat: scale fancyBackground radius and shadow
This commit is contained in:
parent
1f62bd8c67
commit
dc0744a140
@ -21,6 +21,7 @@ const addImageBackground = (
|
|||||||
context: CanvasRenderingContext2D,
|
context: CanvasRenderingContext2D,
|
||||||
canvasDimensions: Dimensions,
|
canvasDimensions: Dimensions,
|
||||||
fancyBackgroundImage: HTMLImageElement,
|
fancyBackgroundImage: HTMLImageElement,
|
||||||
|
exportScale: AppState["exportScale"],
|
||||||
) => {
|
) => {
|
||||||
context.save();
|
context.save();
|
||||||
context.beginPath();
|
context.beginPath();
|
||||||
@ -30,7 +31,7 @@ const addImageBackground = (
|
|||||||
0,
|
0,
|
||||||
canvasDimensions.width,
|
canvasDimensions.width,
|
||||||
canvasDimensions.height,
|
canvasDimensions.height,
|
||||||
FANCY_BG_BORDER_RADIUS,
|
FANCY_BG_BORDER_RADIUS * exportScale,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
roundRect(
|
roundRect(
|
||||||
@ -39,7 +40,7 @@ const addImageBackground = (
|
|||||||
0,
|
0,
|
||||||
canvasDimensions.width,
|
canvasDimensions.width,
|
||||||
canvasDimensions.height,
|
canvasDimensions.height,
|
||||||
FANCY_BG_BORDER_RADIUS,
|
FANCY_BG_BORDER_RADIUS * exportScale,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const scale = getScaleToFill(
|
const scale = getScaleToFill(
|
||||||
@ -93,9 +94,9 @@ const addContentBackground = (
|
|||||||
context.save();
|
context.save();
|
||||||
context.beginPath();
|
context.beginPath();
|
||||||
context.shadowColor = `rgba(0, 0, 0, ${shadow.alpha})`;
|
context.shadowColor = `rgba(0, 0, 0, ${shadow.alpha})`;
|
||||||
context.shadowBlur = shadow.blur;
|
context.shadowBlur = shadow.blur * exportScale;
|
||||||
context.shadowOffsetX = shadow.offsetX;
|
context.shadowOffsetX = shadow.offsetX * exportScale;
|
||||||
context.shadowOffsetY = shadow.offsetY;
|
context.shadowOffsetY = shadow.offsetY * exportScale;
|
||||||
|
|
||||||
if (context.roundRect) {
|
if (context.roundRect) {
|
||||||
context.roundRect(
|
context.roundRect(
|
||||||
@ -158,7 +159,12 @@ export const applyFancyBackgroundOnCanvas = async ({
|
|||||||
height: canvas.height,
|
height: canvas.height,
|
||||||
};
|
};
|
||||||
|
|
||||||
addImageBackground(context, canvasDimensions, fancyBackgroundImage);
|
addImageBackground(
|
||||||
|
context,
|
||||||
|
canvasDimensions,
|
||||||
|
fancyBackgroundImage,
|
||||||
|
exportScale,
|
||||||
|
);
|
||||||
|
|
||||||
addContentBackground(
|
addContentBackground(
|
||||||
context,
|
context,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user