diff options
author | Florrie <towerofnix@gmail.com> | 2018-07-05 09:56:37 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-07-05 09:56:37 -0300 |
commit | 40431bcfd46c457a1cf271b5eae53a35aa1d0b6b (patch) | |
tree | ea358b43927b8382a2561126b720c758bae550af /ui | |
parent | de1c92141d2d4859cf869ec90e50e8eb0e5e8568 (diff) |
addChild(child, afterIndex)
Diffstat (limited to 'ui')
-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() } |