mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Don't render 0 sized images
This commit is contained in:
parent
9cce2c3381
commit
0e17851ba6
@ -133,12 +133,23 @@ export default class Renderer {
|
|||||||
container.style.padding,
|
container.style.padding,
|
||||||
container.style.border
|
container.style.border
|
||||||
);
|
);
|
||||||
const width = typeof image.width === 'number' ? image.width : contentBox.width;
|
const width =
|
||||||
|
typeof image.width === 'number' && image.width > 0
|
||||||
|
? image.width
|
||||||
|
: contentBox.width;
|
||||||
const height =
|
const height =
|
||||||
typeof image.height === 'number' ? image.height : contentBox.height;
|
typeof image.height === 'number' && image.height > 0
|
||||||
this.target.clip([calculatePaddingBoxPath(container.curvedBounds)], () => {
|
? image.height
|
||||||
this.target.drawImage(image, new Bounds(0, 0, width, height), contentBox);
|
: contentBox.height;
|
||||||
});
|
if (width > 0 && height > 0) {
|
||||||
|
this.target.clip([calculatePaddingBoxPath(container.curvedBounds)], () => {
|
||||||
|
this.target.drawImage(
|
||||||
|
image,
|
||||||
|
new Bounds(0, 0, width, height),
|
||||||
|
contentBox
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user