Do not use #splice() for the initial push to the documents / children list.

This commit is contained in:
Jürg Lehni 2011-05-14 12:42:52 +03:00
parent 8c2ad5f331
commit a775e66632
2 changed files with 4 additions and 4 deletions

View file

@ -59,8 +59,8 @@ var Document = this.Document = Base.extend({
this.bounds = Rectangle.create(0, 0, this._size.width,
this._size.height);
this.context = this.canvas.getContext('2d');
// Push it onto paper.documents and adjust index in one:
Base.splice(paper.documents, [this]);
// Push it onto paper.documents and set index:
this._index = paper.documents.push(this) - 1;
this.activate();
this.layers = [];
this.activeLayer = new Layer();

View file

@ -20,8 +20,8 @@ var Layer = this.Layer = Group.extend({
initialize: function() {
this.children = [];
this._document = paper.document;
// Push it onto document.layers and adjust index in one:
Base.splice(this._document.layers, [this]);
// Push it onto document.layers and set index:
this._index = this._document.layers.push(this) - 1;
this.activate();
},