Merge pull request #16 from gjuchault/patch-1

feat(list): allow bigger list items
This commit is contained in:
Iuri Matias 2018-10-24 13:15:45 -04:00 committed by GitHub
commit cad6aceb98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -79,6 +79,10 @@ function List(options) {
this.style.item.focus = this.options.itemFocusEffects;
}
if (this.options.itemHeight) {
this.style.item.height = this.options.itemHeight;
}
this.interactive = options.interactive !== false;
this.mouse = options.mouse || false;
@ -237,7 +241,7 @@ List.prototype.createItem = function(content) {
left: 0,
right: (this.scrollbar ? 1 : 0),
tags: this.parseTags,
height: 1,
height: this.style.item.height || 1,
hoverEffects: this.mouse ? this.style.item.hover : null,
focusEffects: this.mouse ? this.style.item.focus : null,
autoFocus: false
@ -297,7 +301,7 @@ List.prototype.appendItem = function(content) {
content = typeof content === 'string' ? content : content.getContent();
var item = this.createItem(content);
item.position.top = this.items.length;
item.position.top = this.items.map(i => i.height).reduce((a, b) => a + b, 0);
if (!this.screen.autoPadding) {
item.position.top = this.itop + this.items.length;
}