mirror of
https://github.com/konvajs/konva.git
synced 2026-01-23 21:34:50 +08:00
type fixes, fix fast layer bug
This commit is contained in:
@@ -61,16 +61,14 @@ export abstract class Container extends Node {
|
||||
* @name Konva.Container#removeChildren
|
||||
*/
|
||||
removeChildren() {
|
||||
var children = Collection.toCollection(this.children);
|
||||
var child;
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
child = children[i];
|
||||
for (var i = 0; i < this.children.length; i++) {
|
||||
child = this.children[i];
|
||||
// reset parent to prevent many _setChildrenIndices calls
|
||||
child.parent = null;
|
||||
child.index = 0;
|
||||
child.remove();
|
||||
}
|
||||
children = null;
|
||||
this.children = new Collection();
|
||||
return this;
|
||||
}
|
||||
@@ -80,16 +78,14 @@ export abstract class Container extends Node {
|
||||
* @name Konva.Container#destroyChildren
|
||||
*/
|
||||
destroyChildren() {
|
||||
var children = Collection.toCollection(this.children);
|
||||
var child;
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
child = children[i];
|
||||
for (var i = 0; i < this.children.length; i++) {
|
||||
child = this.children[i];
|
||||
// reset parent to prevent many _setChildrenIndices calls
|
||||
child.parent = null;
|
||||
child.index = 0;
|
||||
child.destroy();
|
||||
}
|
||||
children = null;
|
||||
this.children = new Collection();
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user