mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 02:03:47 +08:00
feat(Container): add support for empty arrays passed to add
This commit is contained in:
parent
578191d5d4
commit
57b8dc1566
@ -118,9 +118,12 @@ export abstract class Container<
|
||||
* layer.draw();
|
||||
*/
|
||||
add(...children: ChildType[]) {
|
||||
if (arguments.length > 1) {
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
this.add(arguments[i]);
|
||||
if (children.length === 0) {
|
||||
return this;
|
||||
}
|
||||
if (children.length > 1) {
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
this.add(children[i]);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user