Add drawSelectionHandles and selectionLineWidth options to paper.settings

This commit is contained in:
DD 2017-09-15 12:10:04 -04:00
parent b6f9d73af0
commit c9ce33f47c
3 changed files with 13 additions and 2 deletions

View file

@ -52,7 +52,10 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{
applyMatrix: true,
insertItems: true,
handleSize: 4,
hitTolerance: 0
hitTolerance: 0,
drawSelectionHandles: true,
selectionLineWidth: 1
});
this.project = null;
this.projects = [];
@ -131,6 +134,11 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{
* when drawing selections
* @option [settings.hitTolerance=0] {Number} the default tolerance for hit-
* tests, when no value is specified
* @option [settings.drawSelectionHandles=true] {Boolean} controls whether
* selected items should show control points in addition to the selection
* outline
* @option [settings.selectionLineWidth=0] {Number} the default line width for
* the selection outline, when no value is specified
*/
/**

View file

@ -4408,6 +4408,7 @@ new function() { // Injection scope for hit-test functions shared with project
half = size / 2;
ctx.strokeStyle = ctx.fillStyle = color
? color.toCanvasStyle(ctx) : '#009dec';
ctx.lineWidth=paper.settings.selectionLineWidth;
if (itemSelected)
this._drawSelected(ctx, mx, selectionItems);
if (positionSelected) {

View file

@ -2314,7 +2314,9 @@ new function() { // Scope for drawing
drawSegments(ctx, this, matrix);
// Now stroke it and draw its handles:
ctx.stroke();
drawHandles(ctx, this._segments, matrix, paper.settings.handleSize);
if (paper.settings.drawSelectionHandles) {
drawHandles(ctx, this._segments, matrix, paper.settings.handleSize);
}
}
};
},