Skip to content

Commit a8362f4

Browse files
committed
Unthrottle expansion and remove unneeded workaround
1 parent 4217d20 commit a8362f4

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/lib/scroller.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,11 @@ function Scroller(consoleElement) {
1515
this.console = consoleElement;
1616
this.expandDistance = 200;
1717

18-
//pre-bind functions and throttle expansion
18+
//pre-bind functions
1919
this.refresh = this._renderVisible.bind(this);
2020
this.scroll = this._onScroll.bind(this);
21-
this.expandTop = _.throttle(this._expandTop.bind(this), 150, {
22-
leading: true,
23-
trailing: true
24-
});
25-
this.expandBottom = _.throttle(this._expandBottom.bind(this), 150, {
26-
leading: true,
27-
trailing: true
28-
});
21+
this.expandTop = this._expandTop.bind(this);
22+
this.expandBottom = this._expandBottom.bind(this);
2923
}
3024

3125
Scroller.prototype._generateContent = function(){
@@ -89,7 +83,6 @@ Scroller.prototype.requestRefresh = function(){
8983
Scroller.prototype._renderVisible = function(){
9084
this.animateRequest = null;
9185
if(this.dirty && this.console){
92-
const top = this.console.scrollTop;
9386
if(this.sticky){
9487
this.endPosition = this.lineCount();
9588
this.startPosition = Math.max(this.lineOffset, this.endPosition - this.visibleCount);
@@ -98,9 +91,6 @@ Scroller.prototype._renderVisible = function(){
9891
if(this.jumpToBottom){
9992
this.console.scrollTop = 4000;
10093
this.jumpToBottom = false;
101-
}else if(!this.sticky && this.startPosition > this.lineOffset && top === this.lineOffset){
102-
//cover the situation where the window was fully scrolled faster than expand could keep up and locked to the top
103-
requestAnimationFrame(this.expandTop);
10494
}
10595
this.dirty = false;
10696
}

0 commit comments

Comments
 (0)