mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Setting Path#selected to false should deselect all handles too.
This commit is contained in:
parent
dfe1a7efab
commit
03521796ef
1 changed files with 16 additions and 2 deletions
|
@ -754,14 +754,28 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
setFullySelected: function(selected) {
|
setFullySelected: function(selected) {
|
||||||
|
// No need to call _selectSegments() when selected is false, since
|
||||||
|
// #setSelected() does that for us
|
||||||
|
if (selected)
|
||||||
|
this._selectSegments(true);
|
||||||
|
this.setSelected(selected);
|
||||||
|
},
|
||||||
|
|
||||||
|
setSelected: function(selected) {
|
||||||
|
// Deselect all segments when path is marked as not selected
|
||||||
|
if (!selected)
|
||||||
|
this._selectSegments(false);
|
||||||
|
// No need to pass true for noChildren since Path has none anyway.
|
||||||
|
this.base(selected);
|
||||||
|
},
|
||||||
|
|
||||||
|
_selectSegments: function(selected) {
|
||||||
var length = this._segments.length;
|
var length = this._segments.length;
|
||||||
this._selectedSegmentState = selected
|
this._selectedSegmentState = selected
|
||||||
? length * /*#=*/ SelectionState.POINT : 0;
|
? length * /*#=*/ SelectionState.POINT : 0;
|
||||||
for (var i = 0; i < length; i++)
|
for (var i = 0; i < length; i++)
|
||||||
this._segments[i]._selectionState = selected
|
this._segments[i]._selectionState = selected
|
||||||
? /*#=*/ SelectionState.POINT : 0;
|
? /*#=*/ SelectionState.POINT : 0;
|
||||||
// No need to pass true for noChildren since Path has none anyway.
|
|
||||||
this.setSelected(selected);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSelection: function(segment, oldState, newState) {
|
_updateSelection: function(segment, oldState, newState) {
|
||||||
|
|
Loading…
Reference in a new issue