Skip to content

Commit 15816a4

Browse files
authored
Schedule animation frame runners in each editor's window (microsoft#199934)
Schedule animation frame runners in each editor's window (fixes microsoft#199868)
1 parent 94a3d7b commit 15816a4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/vs/editor/browser/view.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ class EditorRenderingCoordinator {
713713
public static INSTANCE = new EditorRenderingCoordinator();
714714

715715
private _coordinatedRenderings: ICoordinatedRendering[] = [];
716-
private _animationFrameRunner: IDisposable | null = null;
716+
private _animationFrameRunners = new Map<CodeWindow, IDisposable>();
717717

718718
private constructor() { }
719719

@@ -729,23 +729,23 @@ class EditorRenderingCoordinator {
729729
this._coordinatedRenderings.splice(renderingIndex, 1);
730730

731731
if (this._coordinatedRenderings.length === 0) {
732-
// There are no more renderings to coordinate => cancel animation frame
733-
if (this._animationFrameRunner !== null) {
734-
this._animationFrameRunner.dispose();
735-
this._animationFrameRunner = null;
732+
// There are no more renderings to coordinate => cancel animation frames
733+
for (const [_, disposable] of this._animationFrameRunners) {
734+
disposable.dispose();
736735
}
736+
this._animationFrameRunners.clear();
737737
}
738738
}
739739
};
740740
}
741741

742742
private _scheduleRender(window: CodeWindow): void {
743-
if (this._animationFrameRunner === null) {
743+
if (!this._animationFrameRunners.has(window)) {
744744
const runner = () => {
745-
this._animationFrameRunner = null;
745+
this._animationFrameRunners.delete(window);
746746
this._onRenderScheduled();
747747
};
748-
this._animationFrameRunner = dom.runAtThisOrScheduleAtNextAnimationFrame(window, runner, 100);
748+
this._animationFrameRunners.set(window, dom.runAtThisOrScheduleAtNextAnimationFrame(window, runner, 100));
749749
}
750750
}
751751

0 commit comments

Comments
 (0)