fix scroll resizing.
This commit is contained in:
parent
b4566dc48b
commit
0eb04e4e6e
|
@ -1402,11 +1402,11 @@ function ScrollableText(options) {
|
|||
}
|
||||
|
||||
this.screen.on('resize', function() {
|
||||
self.setContent(self.content);
|
||||
self._recalculateIndex();
|
||||
});
|
||||
|
||||
this.on('resize', function() {
|
||||
self.setContent(self.content);
|
||||
self._recalculateIndex();
|
||||
});
|
||||
|
||||
this.contentIndex = 0;
|
||||
|
@ -1457,8 +1457,14 @@ ScrollableText.prototype.scroll = function(offset) {
|
|||
ScrollableText.prototype._setContent = ScrollableText.prototype.setContent;
|
||||
ScrollableText.prototype.setContent = function(content) {
|
||||
var ret = this._setContent(content);
|
||||
this._recalculateIndex(this.content);
|
||||
return ret;
|
||||
};
|
||||
|
||||
this.__content = this.content;
|
||||
ScrollableText.prototype._recalculateIndex = function(content) {
|
||||
if (content != null) this.__content = content;
|
||||
|
||||
if (this.__content == null) this.__content = this.content;
|
||||
this._content = wrapContent(this.__content, this.width - (this.border ? 2 : 0));
|
||||
this.content = this._content.join('\n');
|
||||
|
||||
|
@ -1466,10 +1472,6 @@ ScrollableText.prototype.setContent = function(content) {
|
|||
t += this._content[i].length + 1;
|
||||
}
|
||||
this.contentIndex = t;
|
||||
|
||||
if (this.parent) this.scroll(0);
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue