diff options
Diffstat (limited to 'ui/DisplayElement.js')
-rw-r--r-- | ui/DisplayElement.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ui/DisplayElement.js b/ui/DisplayElement.js index ca50672..1ba9852 100644 --- a/ui/DisplayElement.js +++ b/ui/DisplayElement.js @@ -77,7 +77,7 @@ module.exports = class DisplayElement extends EventEmitter { } } - addChild(child) { + addChild(child, afterIndex = this.children.length) { // TODO Don't let a direct ancestor of this be added as a child. Don't // let itself be one of its childs either! @@ -87,7 +87,7 @@ module.exports = class DisplayElement extends EventEmitter { } child.parent = this - this.children.push(child) + this.children.splice(afterIndex, 0, child) child.fixLayout() } |