Skip to content

Commit

Permalink
fix: Canvas#addCircularImage not creating the round clip
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranet committed Sep 11, 2018
1 parent 3e1e5d0 commit 51a1b36
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,9 @@ class CanvasConstructor {
*/
addCircularImage(imageOrBuffer, dx, dy, radius, restore = false) {
if (restore) this.save();
const diameter = radius * 2;
this._resolveImage(imageOrBuffer, (image) => this.context.drawImage(image, dx - radius, dy - radius, diameter, diameter));
const x = dx - radius, y = dy - radius, diameter = radius * 2;
this.createRoundClip(x, y, radius);
this._resolveImage(imageOrBuffer, (image) => this.context.drawImage(image, x, y, diameter, diameter));
if (restore) this.restore();
return this;
}
Expand Down

0 comments on commit 51a1b36

Please sign in to comment.