list resizing.

This commit is contained in:
Christopher Jeffrey 2013-06-14 03:28:59 -05:00
parent b597bdd1c1
commit b0b949b301
1 changed files with 15 additions and 0 deletions

View File

@ -1498,6 +1498,21 @@ function List(options) {
// self.emit('select', self.items[self.selected], self.selected);
// }
// });
function resize() {
var visible = self.height - (self.border ? 2 : 0);
if (visible >= self.selected + 1) {
//if (self.selected < visible - 1) {
self.childBase = 0;
self.childOffset = self.selected;
} else {
self.childBase = self.selected - visible + 1;
self.childOffset = visible - 1;
}
}
this.screen.on('resize', resize);
this.on('resize', resize);
}
List.prototype.__proto__ = ScrollableBox.prototype;