From 40431bcfd46c457a1cf271b5eae53a35aa1d0b6b Mon Sep 17 00:00:00 2001
From: Florrie <towerofnix@gmail.com>
Date: Thu, 5 Jul 2018 09:56:37 -0300
Subject: addChild(child, afterIndex)

---
 ui/DisplayElement.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'ui')

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()
   }
 
-- 
cgit 1.3.0-6-gf8a5