From df190b6a47ad29278e788e013459539165ac454c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 27 Sep 2014 22:53:37 +0200 Subject: [PATCH] Rearrange Project code for better doc sequence. --- src/project/Project.js | 114 ++++++++++++++++++++--------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/src/project/Project.js b/src/project/Project.js index 0f4d473d..e2267e48 100644 --- a/src/project/Project.js +++ b/src/project/Project.js @@ -172,29 +172,44 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{ return this._index; }, - // Helper function used in Item#copyTo and Layer#initialize - // It's called the same as Item#addChild so Item#copyTo does not need to - // make the distinction. - // TODO: Consider private function with alias in Item? - addChild: function(child) { - if (child instanceof Layer) { - Base.splice(this.layers, [child]); - // Also activate this layer if there was none before - if (!this._activeLayer) - this._activeLayer = child; - } else if (child instanceof Item) { - // Anything else than layers needs to be added to a layer first - (this._activeLayer - // NOTE: If there is no layer and this project is not the active - // one, passing insert: false and calling addChild on the - // project will handle it correctly. - || this.addChild(new Layer(Item.NO_INSERT))).addChild(child); - } else { - child = null; - } - return child; + /** + * Gives access to the project's configurable options. + * + * @type Object + * @bean + * @deprecated use {@link PaperScope#settings} instead. + */ + getOptions: function() { + return this._scope.settings; }, + /** + * {@grouptitle Project Content} + * + * The layers contained within the project. + * + * @name Project#layers + * @type Layer[] + */ + + /** + * The layer which is currently active. New items will be created on this + * layer by default. + * + * @type Layer + * @bean + */ + getActiveLayer: function() { + return this._activeLayer || new Layer({ project: this }); + }, + + /** + * The symbols contained within the project. + * + * @name Project#symbols + * @type Symbol[] + */ + /** * The selected items contained within the project. * @@ -215,15 +230,27 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{ return items; }, - /** - * Gives access to the project's configurable options. - * - * @type Object - * @bean - * @deprecated use {@link PaperScope#settings} instead. - */ - getOptions: function() { - return this._scope.settings; + // Helper function used in Item#copyTo and Layer#initialize + // It's called the same as Item#addChild so Item#copyTo does not need to + // make the distinction. + // TODO: Consider private function with alias in Item? + addChild: function(child) { + if (child instanceof Layer) { + Base.splice(this.layers, [child]); + // Also activate this layer if there was none before + if (!this._activeLayer) + this._activeLayer = child; + } else if (child instanceof Item) { + // Anything else than layers needs to be added to a layer first + (this._activeLayer + // NOTE: If there is no layer and this project is not the active + // one, passing insert: false and calling addChild on the + // project will handle it correctly. + || this.addChild(new Layer(Item.NO_INSERT))).addChild(child); + } else { + child = null; + } + return child; }, // TODO: Implement setSelectedItems? @@ -811,33 +838,6 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{ * @return {Item} the imported Paper.js parent item */ - /** - * {@grouptitle Project Content} - * - * The layers contained within the project. - * - * @name Project#layers - * @type Layer[] - */ - - /** - * The layer which is currently active. New items will be created on this - * layer by default. - * - * @type Layer - * @bean - */ - getActiveLayer: function() { - return this._activeLayer || new Layer({ project: this }); - }, - - /** - * The symbols contained within the project. - * - * @name Project#symbols - * @type Symbol[] - */ - draw: function(ctx, matrix, pixelRatio) { // Increase the _updateVersion before the draw-loop. After that, items // that are visible will have their _updateVersion set to the new value.