mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Rearrange Project code for better doc sequence.
This commit is contained in:
parent
2c9e15b070
commit
df190b6a47
1 changed files with 57 additions and 57 deletions
|
@ -172,29 +172,44 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
return this._index;
|
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
|
* Gives access to the project's configurable options.
|
||||||
// make the distinction.
|
*
|
||||||
// TODO: Consider private function with alias in Item?
|
* @type Object
|
||||||
addChild: function(child) {
|
* @bean
|
||||||
if (child instanceof Layer) {
|
* @deprecated use {@link PaperScope#settings} instead.
|
||||||
Base.splice(this.layers, [child]);
|
*/
|
||||||
// Also activate this layer if there was none before
|
getOptions: function() {
|
||||||
if (!this._activeLayer)
|
return this._scope.settings;
|
||||||
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;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@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.
|
* The selected items contained within the project.
|
||||||
*
|
*
|
||||||
|
@ -215,15 +230,27 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
return items;
|
return items;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
// Helper function used in Item#copyTo and Layer#initialize
|
||||||
* Gives access to the project's configurable options.
|
// It's called the same as Item#addChild so Item#copyTo does not need to
|
||||||
*
|
// make the distinction.
|
||||||
* @type Object
|
// TODO: Consider private function with alias in Item?
|
||||||
* @bean
|
addChild: function(child) {
|
||||||
* @deprecated use {@link PaperScope#settings} instead.
|
if (child instanceof Layer) {
|
||||||
*/
|
Base.splice(this.layers, [child]);
|
||||||
getOptions: function() {
|
// Also activate this layer if there was none before
|
||||||
return this._scope.settings;
|
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?
|
// TODO: Implement setSelectedItems?
|
||||||
|
@ -811,33 +838,6 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
* @return {Item} the imported Paper.js parent item
|
* @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) {
|
draw: function(ctx, matrix, pixelRatio) {
|
||||||
// Increase the _updateVersion before the draw-loop. After that, items
|
// Increase the _updateVersion before the draw-loop. After that, items
|
||||||
// that are visible will have their _updateVersion set to the new value.
|
// that are visible will have their _updateVersion set to the new value.
|
||||||
|
|
Loading…
Reference in a new issue