mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-13 06:29:11 -04:00
Define Project#isEmpty()
This commit is contained in:
parent
ea62b570f3
commit
da9e1f8de7
3 changed files with 14 additions and 2 deletions
src/project
|
@ -92,6 +92,18 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
|||
this.symbols = [];
|
||||
},
|
||||
|
||||
/**
|
||||
* Specifies whether the project has any content or not. Note that since
|
||||
* projects by default are created with one empty layer, this returns alos
|
||||
* {@code true} if that layer exists but is itself empty.
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
isEmpty: function() {
|
||||
return this.layers.length <= 1
|
||||
&& (!this.activeLayer || this.activeLayer.isEmpty());
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes this project from the {@link PaperScope#projects} list, and also
|
||||
* removes its view, if one was defined.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue