mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-07-30 07:39:50 -04: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[]
|
* @type Item[]
|
||||||
*/
|
*/
|
||||||
getSelectedItems: function() {
|
getSelectedItems: function() {
|
||||||
// TODO: Return groups if their children are all selected,
|
// TODO: Return groups if their children are all selected, and filter
|
||||||
// and filter out their children from the list.
|
// out their children from the list.
|
||||||
// TODO: The order of these items should be that of their
|
// TODO: The order of these items should be that of their drawing order.
|
||||||
// drawing order.
|
var selectedItems = this._selectedItems,
|
||||||
var items = [];
|
items = [];
|
||||||
for (var id in this._selectedItems) {
|
for (var id in selectedItems) {
|
||||||
var item = this._selectedItems[id];
|
var item = selectedItems[id];
|
||||||
if (item.isInserted())
|
if (item.isInserted()) {
|
||||||
items.push(item);
|
items.push(item);
|
||||||
|
} else {
|
||||||
|
this._selectedItemCount--;
|
||||||
|
delete selectedItems[id];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
},
|
},
|
||||||
|
// TODO: Implement setSelectedItems?
|
||||||
|
|
||||||
// Project#insertChild() and #addChild() are helper functions called in
|
// Project#insertChild() and #addChild() are helper functions called in
|
||||||
// Item#copyTo(), Layer#initialize(), Layer#_insertSibling()
|
// Item#copyTo(), Layer#initialize(), Layer#_insertSibling()
|
||||||
|
@ -271,7 +276,6 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
return this.insertChild(undefined, item, _preserve);
|
return this.insertChild(undefined, item, _preserve);
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: Implement setSelectedItems?
|
|
||||||
_updateSelection: function(item) {
|
_updateSelection: function(item) {
|
||||||
var id = item._id,
|
var id = item._id,
|
||||||
selectedItems = this._selectedItems;
|
selectedItems = this._selectedItems;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue