Skip to content

Commit

Permalink
Merge pull request #3841 from Tyriar/3840
Browse files Browse the repository at this point in the history
Allow up to double the size for overview ruler decorations
  • Loading branch information
Tyriar authored May 27, 2022
2 parents 1980f67 + 7a652c4 commit 5aaa8da
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/browser/decorations/OverviewRulerRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export class OverviewRulerRenderer extends Disposable {
}));
this.register(this._bufferService.onScroll(() => {
if (this._lastKnownBufferLength !== this._bufferService.buffers.normal.lines.length) {
this._refreshDrawHeightConstants();
this._refreshColorZonePadding();
}
}));
Expand Down Expand Up @@ -132,17 +133,25 @@ export class OverviewRulerRenderer extends Disposable {
drawWidth.center = innerWidth;
drawWidth.right = outerWidth;
// height
drawHeight.full = Math.round(2 * window.devicePixelRatio);
drawHeight.left = Math.round(6 * window.devicePixelRatio);
drawHeight.center = Math.round(6 * window.devicePixelRatio);
drawHeight.right = Math.round(6 * window.devicePixelRatio);
this._refreshDrawHeightConstants();
// x
drawX.full = 0;
drawX.left = 0;
drawX.center = drawWidth.left;
drawX.right = drawWidth.left + drawWidth.center;
}

private _refreshDrawHeightConstants(): void {
drawHeight.full = Math.round(2 * window.devicePixelRatio);
// Calculate actual pixels per line
const pixelsPerLine = this._canvas.height / this._bufferService.buffer.lines.length;
// Clamp actual pixels within a range
const nonFullHeight = Math.round(Math.max(Math.min(pixelsPerLine, 12), 6) * window.devicePixelRatio);
drawHeight.left = nonFullHeight;
drawHeight.center = nonFullHeight;
drawHeight.right = nonFullHeight;
}

private _refreshColorZonePadding(): void {
this._colorZoneStore.setPadding({
full: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.full),
Expand Down

0 comments on commit 5aaa8da

Please sign in to comment.