X-Git-Url: https://git.josue.xyz/?p=VSoRC%2F.git;a=blobdiff_plain;f=node_modules%2Fxterm%2Fsrc%2Fbrowser%2FRenderDebouncer.ts;fp=node_modules%2Fxterm%2Fsrc%2Fbrowser%2FRenderDebouncer.ts;h=0000000000000000000000000000000000000000;hp=27c866dfd58e2e57a2ee07756377f5327f84afdf;hb=5e96dd57ddd883604e87f62bdddcb111c63a6e1a;hpb=acb5f682a2b75b972710cabd81658f63071324b0 diff --git a/node_modules/xterm/src/browser/RenderDebouncer.ts b/node_modules/xterm/src/browser/RenderDebouncer.ts deleted file mode 100644 index 27c866d..0000000 --- a/node_modules/xterm/src/browser/RenderDebouncer.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) 2018 The xterm.js authors. All rights reserved. - * @license MIT - */ - -import { IDisposable } from 'common/Types'; - -/** - * Debounces calls to render terminal rows using animation frames. - */ -export class RenderDebouncer implements IDisposable { - private _rowStart: number | undefined; - private _rowEnd: number | undefined; - private _rowCount: number | undefined; - private _animationFrame: number | undefined; - - constructor( - private _renderCallback: (start: number, end: number) => void - ) { - } - - public dispose(): void { - if (this._animationFrame) { - window.cancelAnimationFrame(this._animationFrame); - this._animationFrame = undefined; - } - } - - public refresh(rowStart: number, rowEnd: number, rowCount: number): void { - this._rowCount = rowCount; - // Get the min/max row start/end for the arg values - rowStart = rowStart !== undefined ? rowStart : 0; - rowEnd = rowEnd !== undefined ? rowEnd : this._rowCount - 1; - // Set the properties to the updated values - this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart; - this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd; - - if (this._animationFrame) { - return; - } - - this._animationFrame = window.requestAnimationFrame(() => this._innerRefresh()); - } - - private _innerRefresh(): void { - // Make sure values are set - if (this._rowStart === undefined || this._rowEnd === undefined || this._rowCount === undefined) { - return; - } - - // Clamp values - this._rowStart = Math.max(this._rowStart, 0); - this._rowEnd = Math.min(this._rowEnd, this._rowCount - 1); - - // Run render callback - this._renderCallback(this._rowStart, this._rowEnd); - - // Reset debouncer - this._rowStart = undefined; - this._rowEnd = undefined; - this._animationFrame = undefined; - } -}