Skip to content

Commit b76f69b

Browse files
committed
Improve Layer documentation.
1 parent 7ee7a26 commit b76f69b

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/item/Layer.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,33 @@ var Layer = this.Layer = Group.extend(/** @lends Layer# */{
3030
* {@link Project#layers} array. The newly created layer will be activated,
3131
* so all newly created items will be placed within it.
3232
*
33+
* @name Layer#initialize
3334
* @param {Item[]} [children] An array of items that will be added to the
3435
* newly created layer.
3536
*
3637
* @example
3738
* var layer = new Layer();
3839
*/
40+
/**
41+
* Creates a new Layer item and places it at the end of the
42+
* {@link Project#layers} array. The newly created layer will be activated,
43+
* so all newly created items will be placed within it.
44+
*
45+
* @param {Object} properties An object literal containing properties to
46+
* be set on the layer.
47+
*
48+
* @example {@paperscript}
49+
* var path = new Path([100, 100], [100, 200]);
50+
* var path2 = new Path([50, 150], [150, 150]);
51+
*
52+
* // Create a layer. The properties in the object literal
53+
* // are set on the newly created layer.
54+
* var layer = new Layer({
55+
* children: [path, path2],
56+
* strokeColor: 'black',
57+
* position: view.center
58+
* });
59+
*/
3960
initialize: function(items) {
4061
this._project = paper.project;
4162
// Push it onto project.layers and set index:

0 commit comments

Comments
 (0)