Skip to content

Commit 2f66b5f

Browse files
authored
Merge pull request xtermjs#5697 from Tyriar/5696
Avoid forced layout in overview ruler impl
2 parents fafb195 + 008aa1b commit 2f66b5f

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/browser/decorations/OverviewRulerRenderer.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ export class OverviewRulerRenderer extends Disposable {
5151
private _shouldUpdateAnchor: boolean | undefined = true;
5252
private _lastKnownBufferLength: number = 0;
5353

54-
private _containerHeight: number | undefined;
55-
5654
constructor(
5755
private readonly _viewportElement: HTMLElement,
5856
private readonly _screenElement: HTMLElement,
@@ -91,13 +89,7 @@ export class OverviewRulerRenderer extends Disposable {
9189
}
9290
}));
9391

94-
// Container height changed
95-
this._register(this._renderService.onRender((): void => {
96-
if (!this._containerHeight || this._containerHeight !== this._screenElement.clientHeight) {
97-
this._queueRefresh(true);
98-
this._containerHeight = this._screenElement.clientHeight;
99-
}
100-
}));
92+
this._register(this._renderService.onDimensionsChange(() => this._queueRefresh(true)));
10193

10294
this._register(this._coreBrowserService.onDprChange(() => this._queueRefresh(true)));
10395
this._register(this._optionsService.onSpecificOptionChange('scrollbar', () => this._queueRefresh(true)));
@@ -144,10 +136,12 @@ export class OverviewRulerRenderer extends Disposable {
144136
}
145137

146138
private _refreshCanvasDimensions(): void {
139+
const cssCanvasHeight = this._renderService.dimensions.css.canvas.height;
140+
const deviceCanvasHeight = this._renderService.dimensions.device.canvas.height;
147141
this._canvas.style.width = `${this._width}px`;
148142
this._canvas.width = Math.round(this._width * this._coreBrowserService.dpr);
149-
this._canvas.style.height = `${this._screenElement.clientHeight}px`;
150-
this._canvas.height = Math.round(this._screenElement.clientHeight * this._coreBrowserService.dpr);
143+
this._canvas.style.height = `${cssCanvasHeight}px`;
144+
this._canvas.height = deviceCanvasHeight;
151145
this._refreshDrawConstants();
152146
this._refreshColorZonePadding();
153147
}

0 commit comments

Comments
 (0)