From 6e725ae18b4d0f76016c9164fe10ec59cc0578ed Mon Sep 17 00:00:00 2001 From: kangax Date: Thu, 4 Apr 2013 12:52:05 +0200 Subject: [PATCH] Support stroke on image instances. Closes #536 --- src/image.class.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/image.class.js b/src/image.class.js index 32b7969c..59e30147 100644 --- a/src/image.class.js +++ b/src/image.class.js @@ -113,6 +113,10 @@ this.clipTo && ctx.restore(); this._removeShadow(ctx); + if (this.stroke) { + this._stroke(ctx); + } + if (this.active && !noTransform) { this.drawBorders(ctx); this.drawControls(ctx); @@ -120,6 +124,18 @@ ctx.restore(); }, + _stroke: function(ctx) { + ctx.save(); + ctx.lineWidth = this.strokeWidth; + ctx.strokeStyle = this.stroke; + ctx.strokeRect( + -this.width / 2, + -this.height / 2, + this.width, + this.height); + ctx.restore(); + }, + /** * Returns object representation of an instance * @method toObject