Merge branch 'master' of github.com:konvajs/konva

This commit is contained in:
Anton Lavrenov 2019-12-18 13:17:07 -05:00
commit f68500ab85

View File

@ -116,22 +116,23 @@ export abstract class Container<ChildType extends Node> extends Node<
* // remember to redraw layer if you changed something
* layer.draw();
*/
add(child: ChildType) {
add(...children: ChildType[]) {
if (arguments.length > 1) {
for (var i = 0; i < arguments.length; i++) {
this.add(arguments[i]);
}
return this;
}
var child = arguments[0];
if (child.getParent()) {
child.moveTo(this);
return this;
}
var children = this.children;
var _children = this.children;
this._validateAdd(child);
child.index = children.length;
child.index = _children.length;
child.parent = this;
children.push(child);
_children.push(child);
this._fire('add', {
child: child
});