mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
DO NOT MERGE : bad workaroud to remaning bug
This adds a sleep in renderReplacedElement so that drawimage works properly when the fix to svg files is used. Without that, it looks like drawImage fires too fast and the fix is not yet done (code is async here) So far I did not find out where I messed up with async code. Any help would be welcome !
This commit is contained in:
parent
9bc852f9f5
commit
f7a3566f22
@ -265,6 +265,9 @@ export class CanvasRenderer extends Renderer {
|
||||
});
|
||||
}
|
||||
|
||||
sleep(ms: number) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
async fixSVGImage(
|
||||
container: ReplacedElementContainer,
|
||||
image: HTMLImageElement | HTMLCanvasElement
|
||||
@ -310,6 +313,7 @@ export class CanvasRenderer extends Renderer {
|
||||
this.path(path);
|
||||
this.ctx.save();
|
||||
this.ctx.clip();
|
||||
await this.sleep(100);
|
||||
this.ctx.drawImage(
|
||||
img,
|
||||
0,
|
||||
|
Loading…
Reference in New Issue
Block a user