allow vertical progress bars.

This commit is contained in:
Christopher Jeffrey 2013-06-12 04:18:47 -05:00
parent 796a3f0ddd
commit 843736d5b1
2 changed files with 9 additions and 1 deletions

View File

@ -1629,6 +1629,7 @@ function ProgressBar(options) {
this.barBg = options.barBg || -1;
if (this.barFg === -1) this.barFg = exports.NORMAL;
if (this.barBg === -1) this.barBg = exports.NORMAL;
this.orientation = options.orientation || 'horizontal';
}
ProgressBar.prototype.__proto__ = Input.prototype;
@ -1650,7 +1651,11 @@ ProgressBar.prototype.render = function(stop) {
if (this.border) xi++, yi++, xl--, yl--;
xl = xi + ((xl - xi) * (this.filled / 100)) | 0;
if (this.orientation === 'horizontal') {
xl = xi + ((xl - xi) * (this.filled / 100)) | 0;
} else if (this.orientation === 'vertical') {
yi = yi + ((yl - yi) - (((yl - yi) * (this.filled / 100)) | 0));
}
dattr = ((this.bold << 18) + (this.underline << 18)) | (this.barFg << 9) | this.barBg;

View File

@ -114,6 +114,9 @@ var progress = new blessed.ProgressBar({
bg: -1
},
ch: ':',
//orientation: 'vertical',
//height: 10,
//width: 3,
width: '50%',
height: 3,
right: 0,