mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Clean up Item#selected code.
This commit is contained in:
parent
d27ff7803c
commit
2679d6eb9e
1 changed files with 7 additions and 12 deletions
|
@ -195,8 +195,8 @@ var Item = this.Item = Base.extend({
|
|||
},
|
||||
|
||||
/**
|
||||
* Specifies whether an item is selected and will also return {@code true} if
|
||||
* the item is partially selected (groups with some selected items/partially
|
||||
* Specifies whether an item is selected and will also return {@code true}
|
||||
* if the item is partially selected (groups with some selected or partially
|
||||
* selected paths).
|
||||
*
|
||||
* Paper.js draws the visual outlines of selected items on top of your
|
||||
|
@ -218,14 +218,11 @@ var Item = this.Item = Base.extend({
|
|||
isSelected: function() {
|
||||
if (this._children) {
|
||||
for (var i = 0, l = this._children.length; i < l; i++) {
|
||||
if (this._children[i].isSelected()) {
|
||||
if (this._children[i].isSelected())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return !!this._selected;
|
||||
}
|
||||
return false;
|
||||
return !!this._selected;
|
||||
},
|
||||
|
||||
setSelected: function(selected) {
|
||||
|
@ -233,11 +230,9 @@ var Item = this.Item = Base.extend({
|
|||
for (var i = 0, l = this._children.length; i < l; i++) {
|
||||
this._children[i].setSelected(selected);
|
||||
}
|
||||
} else {
|
||||
if ((selected = !!selected) != this._selected) {
|
||||
this._selected = selected;
|
||||
this._project._selectItem(this, selected);
|
||||
}
|
||||
} else if ((selected = !!selected) != this._selected) {
|
||||
this._selected = selected;
|
||||
this._project._selectItem(this, selected);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue