mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Update canvas-renderer.ts (#2004)
* Update canvas-renderer.ts Fixed an issue were a page wouldn't render. Line 581 (now 582) threw exception: "Uncaught (in promise) DOMException: Failed to execute 'createPattern' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0." * Update canvas-renderer.ts
This commit is contained in:
parent
ee3ca35636
commit
d4b58960dc
@ -578,8 +578,10 @@ export class CanvasRenderer {
|
|||||||
|
|
||||||
ctx.fillStyle = gradient;
|
ctx.fillStyle = gradient;
|
||||||
ctx.fillRect(0, 0, width, height);
|
ctx.fillRect(0, 0, width, height);
|
||||||
|
if ((width > 0) && (height > 0)) {
|
||||||
const pattern = this.ctx.createPattern(canvas, 'repeat') as CanvasPattern;
|
const pattern = this.ctx.createPattern(canvas, 'repeat') as CanvasPattern;
|
||||||
this.renderRepeat(path, pattern, x, y);
|
this.renderRepeat(path, pattern, x, y);
|
||||||
|
}
|
||||||
} else if (isRadialGradient(backgroundImage)) {
|
} else if (isRadialGradient(backgroundImage)) {
|
||||||
const [path, left, top, width, height] = calculateBackgroundRendering(container, index, [
|
const [path, left, top, width, height] = calculateBackgroundRendering(container, index, [
|
||||||
null,
|
null,
|
||||||
|
Loading…
Reference in New Issue
Block a user