automatically find screen if we are using multiple.
This commit is contained in:
parent
a9fb228f23
commit
8007aa8ee7
|
@ -25,10 +25,29 @@ function Node(options) {
|
||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
|
||||||
|
/*
|
||||||
this.screen = this.screen
|
this.screen = this.screen
|
||||||
|| options.screen
|
|| options.screen
|
||||||
|
|| (options.parent && options.parent.screen)
|
||||||
|| require('./screen').global
|
|| require('./screen').global
|
||||||
|| (function(){throw new Error('No active screen.')})();
|
|| (function(){throw new Error('No active screen.')})();
|
||||||
|
*/
|
||||||
|
|
||||||
|
var element;
|
||||||
|
if (!options.screen && options.parent) {
|
||||||
|
element = options.parent;
|
||||||
|
while (element && element.type !== 'screen') {
|
||||||
|
element = element.parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.screen = this.screen
|
||||||
|
|| options.screen
|
||||||
|
|| element
|
||||||
|
|| require('./screen').global
|
||||||
|
|| (function(){throw new Error('No active screen.')})();
|
||||||
|
|
||||||
this.parent = options.parent || null;
|
this.parent = options.parent || null;
|
||||||
this.children = [];
|
this.children = [];
|
||||||
this.$ = this._ = this.data = {};
|
this.$ = this._ = this.data = {};
|
||||||
|
|
Loading…
Reference in New Issue