Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control customization part 2 - Allow for separate corner filling and cornerStroke #2933

Merged
merged 25 commits into from
May 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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