Skip to content

Commit

Permalink
fix inline background color wrap rendering niklasvh#2558
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharcoux committed Aug 31, 2023
1 parent a6651e3 commit df4c328
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
16 changes: 15 additions & 1 deletion src/render/canvas/canvas-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,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
15 changes: 9 additions & 6 deletions src/render/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ export const transformPath = (path: Path[], deltaX: number, deltaY: number, delt
});
};

export const reversePath = (path: Path[]) : Path[] => {
return path.slice(0).reverse().map((point) => {
return point.reverse();
});
}
export type Path = Vector | BezierCurve;
export const reversePath = (path: Path[]): Path[] => {
return path
.slice(0)
.reverse()
.map((point) => {
return point.reverse();
});
};
export type Path = Vector | BezierCurve;

0 comments on commit df4c328

Please sign in to comment.