mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
fix renderBackgroundImage When receiving an image with 0 width or height
This commit is contained in:
parent
6020386bbe
commit
190c7b63ee
@ -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),
|
||||||
|
Loading…
Reference in New Issue
Block a user