mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-21 11:51:51 +00:00
Support stroke on image instances. Closes #536
This commit is contained in:
parent
4d037e979a
commit
6e725ae18b
1 changed files with 16 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue