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:
Sebastien Ponce 2023-01-12 18:29:29 +01:00
parent 9bc852f9f5
commit f7a3566f22

View File

@ -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,