Useful message if stage container is not founded

This commit is contained in:
Лаврёнов Антон 2014-03-01 17:45:35 +08:00
parent 9397a96127
commit 046ca0257b
2 changed files with 4 additions and 3 deletions

View File

@ -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();

View File

@ -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;