Mon 21 Jul 22:43:21 CEST 2025
This commit is contained in:
parent
2ee76647a6
commit
11d1497f94
82
js/term/widgets/line.js
Normal file
82
js/term/widgets/line.js
Normal file
|
@ -0,0 +1,82 @@
|
|||
/**
|
||||
** ==============================
|
||||
** O O O OOOO
|
||||
** O O O O O O
|
||||
** O O O O O O
|
||||
** OOOO OOOO O OOO OOOO
|
||||
** O O O O O O O
|
||||
** O O O O O O O
|
||||
** OOOO OOOO O O OOOO
|
||||
** ==============================
|
||||
** Dr. Stefan Bosse http://www.bsslab.de
|
||||
**
|
||||
** COPYRIGHT: THIS SOFTWARE, EXECUTABLE AND SOURCE CODE IS OWNED
|
||||
** BY THE AUTHOR(S).
|
||||
** THIS SOURCE CODE MAY NOT BE COPIED, EXTRACTED,
|
||||
** MODIFIED, OR OTHERWISE USED IN A CONTEXT
|
||||
** OUTSIDE OF THE SOFTWARE SYSTEM.
|
||||
**
|
||||
** $AUTHORS: Christopher Jeffrey, Stefan Bosse
|
||||
** $INITIAL: (C) 2013-2015, Christopher Jeffrey and contributors
|
||||
** $MODIFIED: by sbosse
|
||||
** $REVESIO: 1.2.1
|
||||
**
|
||||
** $INFO:
|
||||
**
|
||||
** line.js - line element for blessed
|
||||
**
|
||||
** $ENDOFINFO
|
||||
*/
|
||||
|
||||
/**
|
||||
* Modules
|
||||
*/
|
||||
var Comp = Require('com/compat');
|
||||
|
||||
var Node = Require('term/widgets/node');
|
||||
var Box = Require('term/widgets/box');
|
||||
|
||||
/**
|
||||
* Line
|
||||
*/
|
||||
|
||||
function Line(options) {
|
||||
if (!instanceOf(this,Node)) {
|
||||
return new Line(options);
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
|
||||
var orientation = options.orientation || 'vertical';
|
||||
delete options.orientation;
|
||||
|
||||
if (orientation === 'vertical') {
|
||||
options.width = 1;
|
||||
} else {
|
||||
options.height = 1;
|
||||
}
|
||||
|
||||
Box.call(this, options);
|
||||
|
||||
this.ch = !options.type || options.type === 'line'
|
||||
? orientation === 'horizontal' ? '─' : '│'
|
||||
: options.ch || ' ';
|
||||
|
||||
this.border = {
|
||||
type: 'bg',
|
||||
__proto__: this
|
||||
};
|
||||
|
||||
this.style.border = this.style;
|
||||
}
|
||||
|
||||
//Line.prototype.__proto__ = Box.prototype;
|
||||
inheritPrototype(Line,Box);
|
||||
|
||||
Line.prototype.type = 'line';
|
||||
|
||||
/**
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Line;
|
Loading…
Reference in New Issue
Block a user