3939var PaperScope = this . PaperScope = Base . extend ( /** @lends PaperScope# */ {
4040
4141 /**
42- * Creates a PaperScope object and an empty { @link Project} for it. If a
43- * canvas is provided, it also creates a {@link View} for it.
44- * Both project and view are linked to this scope.
42+ * Creates a PaperScope object. If a canvas is provided, it also creates a
43+ * an empty { @link Project} and a {@link View} for it, both linked to this
44+ * scope.
4545 *
4646 * @name PaperScope#initialize
4747 * @function
4848 * @param {HTMLCanvasElement } canvas The canvas this scope should be
49- * associated with.
49+ * associated with.
5050 */
5151 initialize : function ( canvas , script ) {
5252 // script is only used internally, when creating scopes for PaperScript.
5353 // Whenever a PaperScope is created, it automatically becomes the active
5454 // one.
5555 paper = this ;
56- this . views = [ ] ;
5756 this . view = null ;
57+ this . views = [ ] ;
58+ this . project = null ;
5859 this . projects = [ ] ;
59- // Since the global paper variable points to this PaperScope, the
60- // created project and view are automatically associated with it.
61- this . project = new Project ( ) ;
6260 this . tool = null ;
6361 this . tools = [ ] ;
6462 var obj = script || canvas ;
@@ -72,6 +70,10 @@ var PaperScope = this.PaperScope = Base.extend(/** @lends PaperScope# */{
7270 script . setAttribute ( 'id' , this . _id ) ;
7371 PaperScope . _scopes [ this . _id ] = this ;
7472 if ( canvas ) {
73+ // Create an empty project for the scope.
74+ // Since the global paper variable points to this PaperScope, the
75+ // created project and view are automatically associated with it.
76+ this . project = new Project ( ) ;
7577 // Create a view for the canvas.
7678 this . view = new View ( canvas ) ;
7779 }
0 commit comments