diff options
Diffstat (limited to 'ui/DisplayElement.js')
-rw-r--r-- | ui/DisplayElement.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/DisplayElement.js b/ui/DisplayElement.js index 8a2aa71..9498487 100644 --- a/ui/DisplayElement.js +++ b/ui/DisplayElement.js @@ -87,7 +87,12 @@ module.exports = class DisplayElement extends EventEmitter { } child.parent = this - this.children.splice(afterIndex, 0, child) + + if (afterIndex === this.children.length) { + this.children.push(child) + } else { + this.children.splice(afterIndex, 0, child) + } if (fixLayout) { child.fixLayout() |