From 046ca0257b76452b78f24982c30d4196c641e06f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B0=D0=B2=D1=80=D1=91=D0=BD=D0=BE=D0=B2=20=D0=90?= =?UTF-8?q?=D0=BD=D1=82=D0=BE=D0=BD?= Date: Sat, 1 Mar 2014 17:45:35 +0800 Subject: [PATCH] Useful message if stage container is not founded --- src/Layer.js | 3 --- src/Stage.js | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Layer.js b/src/Layer.js index a482ed8a..a908f23c 100644 --- a/src/Layer.js +++ b/src/Layer.js @@ -32,9 +32,6 @@ this.hitCanvas = new Kinetic.HitCanvas(); // call super constructor Kinetic.Container.call(this, config); - if (!Kinetic.Util.isBrowser()) { - this.canvas.setSize(this.attrs.width, this.attrs.height); - } }, _validateAdd: function(child) { var type = child.getType(); diff --git a/src/Stage.js b/src/Stage.js index ec5d537c..fc76f9c6 100644 --- a/src/Stage.js +++ b/src/Stage.js @@ -80,7 +80,11 @@ */ setContainer: function(container) { if( typeof container === STRING) { + var id = container; container = Kinetic.document.getElementById(container); + if (!container) { + throw 'Can not find container in document with id ' + id; + } } this._setAttr(CONTAINER, container); return this;