mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Add drawSelectionHandles and selectionLineWidth options to paper.settings
This commit is contained in:
parent
b6f9d73af0
commit
c9ce33f47c
3 changed files with 13 additions and 2 deletions
|
@ -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
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue