Skip to content

Commit

Permalink
fix: fix inline background color wrap rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavotoyota committed Jul 14, 2023
1 parent 6020386 commit ea5be24
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/render/canvas/canvas-renderer.ts
Expand Up @@ -714,7 +714,21 @@ export class CanvasRenderer extends Renderer {

if (!isTransparent(styles.backgroundColor)) {
this.ctx.fillStyle = asString(styles.backgroundColor);
this.ctx.fill();

if (styles.display === DISPLAY.INLINE) {
for (const textNode of paint.container.textNodes) {
for (const textBound of textNode.textBounds) {
this.ctx.fillRect(
textBound.bounds.left,
textBound.bounds.top,
textBound.bounds.width,
textBound.bounds.height
);
}
}
} else {
this.ctx.fill();
}
}

await this.renderBackgroundImage(paint.container);
Expand Down

0 comments on commit ea5be24

Please sign in to comment.