mirror of
https://github.com/konvajs/konva.git
synced 2026-03-03 16:58:33 +08:00
Useful message if stage container is not founded
This commit is contained in:
@@ -32,9 +32,6 @@
|
|||||||
this.hitCanvas = new Kinetic.HitCanvas();
|
this.hitCanvas = new Kinetic.HitCanvas();
|
||||||
// call super constructor
|
// call super constructor
|
||||||
Kinetic.Container.call(this, config);
|
Kinetic.Container.call(this, config);
|
||||||
if (!Kinetic.Util.isBrowser()) {
|
|
||||||
this.canvas.setSize(this.attrs.width, this.attrs.height);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
_validateAdd: function(child) {
|
_validateAdd: function(child) {
|
||||||
var type = child.getType();
|
var type = child.getType();
|
||||||
|
|||||||
@@ -80,7 +80,11 @@
|
|||||||
*/
|
*/
|
||||||
setContainer: function(container) {
|
setContainer: function(container) {
|
||||||
if( typeof container === STRING) {
|
if( typeof container === STRING) {
|
||||||
|
var id = container;
|
||||||
container = Kinetic.document.getElementById(container);
|
container = Kinetic.document.getElementById(container);
|
||||||
|
if (!container) {
|
||||||
|
throw 'Can not find container in document with id ' + id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this._setAttr(CONTAINER, container);
|
this._setAttr(CONTAINER, container);
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
Reference in New Issue
Block a user