mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
Document: implement selectAll() and deselectAll().
This commit is contained in:
parent
d71450c0b1
commit
32f04f6162
1 changed files with 20 additions and 0 deletions
|
@ -80,6 +80,26 @@ var Document = this.Document = Base.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects all items in the document.
|
||||||
|
*/
|
||||||
|
selectAll: function() {
|
||||||
|
// TODO: is using for var i in good practice?
|
||||||
|
// or should we use Base.each? (JP)
|
||||||
|
for (var i = 0, l = this.layers.length; i < l; i++)
|
||||||
|
this.layers[i].setSelected(true);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deselects all selected items in the document.
|
||||||
|
*/
|
||||||
|
deselectAll: function() {
|
||||||
|
// TODO: is using for var i in good practice?
|
||||||
|
// or should we use Base.each? (JP)
|
||||||
|
for (var i in this._selectedItems)
|
||||||
|
this._selectedItems[i].setSelected(false);
|
||||||
|
},
|
||||||
|
|
||||||
draw: function() {
|
draw: function() {
|
||||||
if (this.canvas) {
|
if (this.canvas) {
|
||||||
var ctx = this.context;
|
var ctx = this.context;
|
||||||
|
|
Loading…
Reference in a new issue