Skip to content

Commit

Permalink
Apply border radius correctly on image elements
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasvh committed Aug 3, 2017
1 parent fe97851 commit ad1119a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/CanvasRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ export default class CanvasRenderer {
);
const width = typeof image.width === 'number' ? image.width : contentBox.width;
const height = typeof image.height === 'number' ? image.height : contentBox.height;

this.ctx.save();
this.path(calculatePaddingBoxPath(container.curvedBounds));
this.ctx.clip();
this.ctx.drawImage(
image,
0,
Expand All @@ -100,6 +102,7 @@ export default class CanvasRenderer {
contentBox.width,
contentBox.height
);
this.ctx.restore();
}
}

Expand Down

0 comments on commit ad1119a

Please sign in to comment.