diff --git a/src/core/display/Container.js b/src/core/display/Container.js index b3792ef..ed8cd5f 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -74,12 +74,12 @@ child.parent = this; + this.children.push(child); + // ensure a transform will be recalculated.. this.transform._parentID = -1; this._boundsID++; - this.children.push(child); - // TODO - lets either do all callbacks or all events.. not both! this.onChildrenChange(this.children.length - 1); child.emit('added', this); @@ -111,6 +111,10 @@ this.children.splice(index, 0, child); + // ensure a transform will be recalculated.. + this.transform._parentID = -1; + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! this.onChildrenChange(index); child.emit('added', this); @@ -174,6 +178,7 @@ removeItems(this.children, currentIndex, 1); // remove from old position this.children.splice(index, 0, child); // add at new position + this.onChildrenChange(index); } @@ -247,6 +252,10 @@ child.parent = null; removeItems(this.children, index, 1); + // ensure a transform will be recalculated.. + this.transform._parentID = -1; + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! this.onChildrenChange(index); child.emit('removed', this); @@ -277,6 +286,13 @@ removed[i].parent = null; } + // ensure a transform will be recalculated.. + if (this.transform) + { + this.transform._parentID = -1; + } + this._boundsID++; + this.onChildrenChange(beginIndex); for (let i = 0; i < removed.length; ++i)