mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
Simplify and compress code a bit.
This commit is contained in:
parent
0700c51a85
commit
4bfc56bb6d
1 changed files with 6 additions and 13 deletions
|
@ -190,22 +190,15 @@ var Segment = this.Segment = Base.extend({
|
||||||
// If the selection state of the segment has changed, we need to let
|
// If the selection state of the segment has changed, we need to let
|
||||||
// it's path know and possibly add or remove it from
|
// it's path know and possibly add or remove it from
|
||||||
// document._selectedItems
|
// document._selectedItems
|
||||||
if (wasSelected == !this._selectionState) {
|
if (wasSelected != !!this._selectionState) {
|
||||||
var path = this._path,
|
var path = this._path,
|
||||||
selectedItems = path._document._selectedItems;
|
count = path._selectedSegmentCount
|
||||||
if (!this._selectionState) {
|
+= this._selectionState ? 1 : -1;
|
||||||
path._selectedSegmentCount--;
|
if (count <= 1)
|
||||||
if (path._selectedSegmentCount == 0)
|
path._document._selectItem(path, count == 1);
|
||||||
path._document._selectItem(path, false);
|
}
|
||||||
} else {
|
|
||||||
path._selectedSegmentCount++;
|
|
||||||
if (path._selectedSegmentCount == 1)
|
|
||||||
path._document._selectItem(path, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: Port setSelected(selected) back to Scriptographer
|
|
||||||
isSelected: function() {
|
isSelected: function() {
|
||||||
return this._isSelected(this._point);
|
return this._isSelected(this._point);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue