Skip to content

Commit 24b04e9

Browse files
committed
Merge branch 'master' into osc52
2 parents 0562f32 + 21d7f78 commit 24b04e9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: src/browser/Viewport.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export class Viewport extends Disposable implements IViewport {
3636
private _activeBuffer: IBuffer;
3737
private _renderDimensions: IRenderDimensions;
3838

39+
private _smoothScrollAnimationFrame: number = 0;
40+
3941
// Stores a partial line amount when scrolling, this is used to keep track of how much of a line
4042
// is scrolled so we can "scroll" over partial lines and feel natural on touchpads. This is a
4143
// quick fix and could have a more robust solution in place that reset the value when needed.
@@ -211,7 +213,12 @@ export class Viewport extends Disposable implements IViewport {
211213

212214
// Continue or finish smooth scroll
213215
if (percent < 1) {
214-
this._coreBrowserService.window.requestAnimationFrame(() => this._smoothScroll());
216+
if (!this._smoothScrollAnimationFrame) {
217+
this._smoothScrollAnimationFrame = this._coreBrowserService.window.requestAnimationFrame(() => {
218+
this._smoothScrollAnimationFrame = 0;
219+
this._smoothScroll();
220+
});
221+
}
215222
} else {
216223
this._clearSmoothScrollState();
217224
}

0 commit comments

Comments
 (0)