fix: reset children indexes after sort
This commit is contained in:
parent
e3d0ca626e
commit
a4040a39b9
|
@ -54,13 +54,10 @@ export class Container extends Renderable {
|
|||
this._children.splice(index, 1);
|
||||
this.container.removeChild(child.internal);
|
||||
}
|
||||
|
||||
removeChild(child) {
|
||||
this._removeChild(child);
|
||||
this._childrenIndexes = new Map();
|
||||
for (const i in this._children) {
|
||||
const child = this._children[i];
|
||||
this._childrenIndexes.set(child, i);
|
||||
}
|
||||
this._resetChildrenIndexes();
|
||||
}
|
||||
|
||||
removeAllChildren() {
|
||||
|
@ -70,6 +67,14 @@ export class Container extends Renderable {
|
|||
this._childrenIndexes = new Map();
|
||||
}
|
||||
|
||||
_resetChildrenIndexes() {
|
||||
this._childrenIndexes = new Map();
|
||||
for (const i in this._children) {
|
||||
const child = this._children[i];
|
||||
this._childrenIndexes.set(child, i);
|
||||
}
|
||||
}
|
||||
|
||||
tick() {
|
||||
if (!this.isDirty) {
|
||||
return;
|
||||
|
@ -97,6 +102,7 @@ export class Container extends Renderable {
|
|||
this.container.children = this._children.map((child) => {
|
||||
return child.internal;
|
||||
});
|
||||
this._resetChildrenIndexes();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user