From a775e6663208b7afcd6a817fccc555aee420fde0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 14 May 2011 12:42:52 +0300 Subject: [PATCH] Do not use #splice() for the initial push to the documents / children list. --- src/document/Document.js | 4 ++-- src/item/Layer.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/document/Document.js b/src/document/Document.js index 60ad0313..7b67cab4 100644 --- a/src/document/Document.js +++ b/src/document/Document.js @@ -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(); diff --git a/src/item/Layer.js b/src/item/Layer.js index faaa7a52..f2e17549 100644 --- a/src/item/Layer.js +++ b/src/item/Layer.js @@ -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(); },