mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Do not use #splice() for the initial push to the documents / children list.
This commit is contained in:
parent
8c2ad5f331
commit
a775e66632
2 changed files with 4 additions and 4 deletions
|
@ -59,8 +59,8 @@ var Document = this.Document = Base.extend({
|
||||||
this.bounds = Rectangle.create(0, 0, this._size.width,
|
this.bounds = Rectangle.create(0, 0, this._size.width,
|
||||||
this._size.height);
|
this._size.height);
|
||||||
this.context = this.canvas.getContext('2d');
|
this.context = this.canvas.getContext('2d');
|
||||||
// Push it onto paper.documents and adjust index in one:
|
// Push it onto paper.documents and set index:
|
||||||
Base.splice(paper.documents, [this]);
|
this._index = paper.documents.push(this) - 1;
|
||||||
this.activate();
|
this.activate();
|
||||||
this.layers = [];
|
this.layers = [];
|
||||||
this.activeLayer = new Layer();
|
this.activeLayer = new Layer();
|
||||||
|
|
|
@ -20,8 +20,8 @@ var Layer = this.Layer = Group.extend({
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.children = [];
|
this.children = [];
|
||||||
this._document = paper.document;
|
this._document = paper.document;
|
||||||
// Push it onto document.layers and adjust index in one:
|
// Push it onto document.layers and set index:
|
||||||
Base.splice(this._document.layers, [this]);
|
this._index = this._document.layers.push(this) - 1;
|
||||||
this.activate();
|
this.activate();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue