fix check image with 0 width or height

This commit is contained in:
Dani 2022-06-03 09:24:59 +02:00
parent 190c7b63ee
commit 4970be9d4c

View File

@ -595,13 +595,10 @@ export class CanvasRenderer extends Renderer {
}
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, [
widthTmp,
heightTmp,
widthTmp / heightTmp
image.width,
image.height,
image.width / image.height
]);
const pattern = this.ctx.createPattern(
this.resizeImage(image, width, height),
@ -614,8 +611,8 @@ export class CanvasRenderer extends Renderer {
const [lineLength, x0, x1, y0, y1] = calculateGradientDirection(backgroundImage.angle, width, height);
const canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
canvas.width = Math.max(1, width);
canvas.height = Math.max(1, height);
const ctx = canvas.getContext('2d') as CanvasRenderingContext2D;
const gradient = ctx.createLinearGradient(x0, y0, x1, y1);