fix scrolling glitch.
This commit is contained in:
parent
73939984b4
commit
b8f1241bca
|
@ -3243,7 +3243,8 @@ ScrollableBox.prototype.scroll = function(offset, always) {
|
|||
, i
|
||||
, max
|
||||
, emax
|
||||
, t;
|
||||
, t
|
||||
, l;
|
||||
|
||||
if (diff === 0) {
|
||||
return this.emit('scroll');
|
||||
|
@ -3257,6 +3258,7 @@ ScrollableBox.prototype.scroll = function(offset, always) {
|
|||
max = this._clines.length - (this.height - this.iheight);
|
||||
if (max < 0) max = 0;
|
||||
emax = this._scrollBottom() - (this.height - this.iheight);
|
||||
if (emax < 0) emax = 0;
|
||||
|
||||
this.childBase = Math.min(this.childBase, Math.max(emax, max));
|
||||
diff = this.childBase - base;
|
||||
|
@ -3268,13 +3270,13 @@ ScrollableBox.prototype.scroll = function(offset, always) {
|
|||
}
|
||||
|
||||
if (diff > 0) {
|
||||
for (i = base; i < this.childBase; i++) {
|
||||
if (!this._clines[i]) continue;
|
||||
l = Math.min(this.childBase, this._clines.length);
|
||||
for (i = base; i < l; i++) {
|
||||
this.contentIndex += this._clines[i].length + 1;
|
||||
}
|
||||
} else {
|
||||
for (i = base - 1; i >= this.childBase; i--) {
|
||||
if (!this._clines[i]) continue;
|
||||
l = Math.min(this.childBase, this._clines.length);
|
||||
for (i = base - 1; i >= l; i--) {
|
||||
this.contentIndex -= this._clines[i].length + 1;
|
||||
}
|
||||
}
|
||||
|
@ -3300,9 +3302,9 @@ ScrollableBox.prototype.scroll = function(offset, always) {
|
|||
};
|
||||
|
||||
ScrollableBox.prototype._recalculateIndex = function() {
|
||||
var max, emax, i, t;
|
||||
var max, emax, i, t, l;
|
||||
|
||||
if (this.detached || !this.scrollabe) {
|
||||
if (this.detached || !this.scrollable) {
|
||||
this.contentIndex = 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -3310,6 +3312,7 @@ ScrollableBox.prototype._recalculateIndex = function() {
|
|||
max = this._clines.length - (this.height - this.iheight);
|
||||
if (max < 0) max = 0;
|
||||
emax = this._scrollBottom() - (this.height - this.iheight);
|
||||
if (emax < 0) emax = 0;
|
||||
|
||||
this.childBase = Math.min(this.childBase, Math.max(emax, max));
|
||||
|
||||
|
@ -3319,8 +3322,8 @@ ScrollableBox.prototype._recalculateIndex = function() {
|
|||
this.childBase = this.baseLimit;
|
||||
}
|
||||
|
||||
for (i = 0, t = 0; i < this.childBase; i++) {
|
||||
if (!this._clines[i]) continue;
|
||||
l = Math.min(this.childBase, this._clines.length);
|
||||
for (i = 0, t = 0; i < l; i++) {
|
||||
t += this._clines[i].length + 1;
|
||||
}
|
||||
|
||||
|
@ -4215,8 +4218,8 @@ Textarea.prototype._listener = function(ch, key) {
|
|||
|
||||
Textarea.prototype._typeScroll = function() {
|
||||
// XXX Workaround
|
||||
var width = this.height - this.iheight;
|
||||
if (this._clines.length - this.childBase > width) {
|
||||
var height = this.height - this.iheight;
|
||||
if (this._clines.length - this.childBase > height) {
|
||||
//this.setContent(this.value + '\n');
|
||||
this.scroll(this._clines.length);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue