mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Some minor improvements in handling of selectedItems.
This commit is contained in:
parent
d9c9b3d1a2
commit
cd366982d6
1 changed files with 13 additions and 9 deletions
|
@ -225,18 +225,23 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
|||
* @type Item[]
|
||||
*/
|
||||
getSelectedItems: function() {
|
||||
// TODO: Return groups if their children are all selected,
|
||||
// and filter out their children from the list.
|
||||
// TODO: The order of these items should be that of their
|
||||
// drawing order.
|
||||
var items = [];
|
||||
for (var id in this._selectedItems) {
|
||||
var item = this._selectedItems[id];
|
||||
if (item.isInserted())
|
||||
// TODO: Return groups if their children are all selected, and filter
|
||||
// out their children from the list.
|
||||
// TODO: The order of these items should be that of their drawing order.
|
||||
var selectedItems = this._selectedItems,
|
||||
items = [];
|
||||
for (var id in selectedItems) {
|
||||
var item = selectedItems[id];
|
||||
if (item.isInserted()) {
|
||||
items.push(item);
|
||||
} else {
|
||||
this._selectedItemCount--;
|
||||
delete selectedItems[id];
|
||||
}
|
||||
}
|
||||
return items;
|
||||
},
|
||||
// TODO: Implement setSelectedItems?
|
||||
|
||||
// Project#insertChild() and #addChild() are helper functions called in
|
||||
// Item#copyTo(), Layer#initialize(), Layer#_insertSibling()
|
||||
|
@ -271,7 +276,6 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
|||
return this.insertChild(undefined, item, _preserve);
|
||||
},
|
||||
|
||||
// TODO: Implement setSelectedItems?
|
||||
_updateSelection: function(item) {
|
||||
var id = item._id,
|
||||
selectedItems = this._selectedItems;
|
||||
|
|
Loading…
Reference in a new issue