fix renderBackgroundImage When receiving an image with 0 width or height

This commit is contained in:
Dani 2022-06-03 08:53:36 +02:00
parent 6020386bbe
commit 190c7b63ee

View File

@ -595,10 +595,13 @@ export class CanvasRenderer extends Renderer {
} }
if (image) { if (image) {
let widthTmp = Math.max(1, image.width);
let heightTmp = Math.max(1, image.height);
const [path, x, y, width, height] = calculateBackgroundRendering(container, index, [ const [path, x, y, width, height] = calculateBackgroundRendering(container, index, [
image.width, widthTmp,
image.height, heightTmp,
image.width / image.height widthTmp / heightTmp
]); ]);
const pattern = this.ctx.createPattern( const pattern = this.ctx.createPattern(
this.resizeImage(image, width, height), this.resizeImage(image, width, height),