Skip to content

Commit

Permalink
Control customization part 2 - Allow for separate corner filling and …
Browse files Browse the repository at this point in the history
…cornerStroke (#2933)
  • Loading branch information
asturur committed May 4, 2016
1 parent 27fd548 commit 0410aae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/mixins/object_interactivity.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,10 @@
methodName = this.transparentCorners ? 'strokeRect' : 'fillRect';

ctx.save();

ctx.lineWidth = 1;
ctx.strokeStyle = ctx.fillStyle = this.cornerColor;
if (!this.transparentCorners) {
ctx.strokeStyle = this.cornerStrokeColor;
}
this._setLineDash(ctx, this.cornerDashArray, null);

// top-left
Expand Down Expand Up @@ -359,6 +360,9 @@
var size = this.cornerSize;
isVML() || this.transparentCorners || ctx.clearRect(left, top, size, size);
ctx[methodName](left, top, size, size);
if (!this.transparentCorners && this.cornerStrokeColor) {
ctx.strokeRect(left, top, size, size);
}
},

/**
Expand Down
8 changes: 8 additions & 0 deletions src/shapes/object.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,14 @@
*/
cornerColor: 'rgba(102,153,255,0.5)',

/**
* Color of controlling corners of an object (when it's active and transparentCorners false)
* @since 1.6.2
* @type String
* @default
*/
cornerStrokeColor: null,

/**
* Array specifying dash pattern of an object's control (hasBorder must be true)
* @since 1.6.2
Expand Down

0 comments on commit 0410aae

Please sign in to comment.