From 7351c8a716f7825d7fb506d2b1a04687929e4741 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 5 Aug 2015 04:34:18 -0700 Subject: [PATCH] set screen.index. --- lib/widgets/node.js | 2 +- lib/widgets/screen.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/widgets/node.js b/lib/widgets/node.js index cdcfca8..d3ce283 100644 --- a/lib/widgets/node.js +++ b/lib/widgets/node.js @@ -33,7 +33,7 @@ function Node(options) { this.children = []; this.$ = this._ = this.data = {}; this.uid = Node.uid++; - this.index = -1; + this.index = this.index != null ? this.index : -1; if (this.type !== 'screen') { this.detached = true; diff --git a/lib/widgets/screen.js b/lib/widgets/screen.js index 2b37370..3904881 100644 --- a/lib/widgets/screen.js +++ b/lib/widgets/screen.js @@ -200,6 +200,7 @@ Screen.bind = function(screen) { if (!~Screen.instances.indexOf(screen)) { Screen.instances.push(screen); + screen.index = Screen.total; Screen.total++; }