mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
Useful message if stage container is not founded
This commit is contained in:
parent
9397a96127
commit
046ca0257b
@ -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();
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user