add listener for on option change

This commit is contained in:
meganrogge
2022-03-15 10:53:32 -04:00
parent 39f9c3507b
commit 4ef5f6ae86
@@ -45,6 +45,11 @@ export class OverviewRulerRenderer extends Disposable {
this.register(addDisposableDomListener(window, 'resize', () => this.refreshDecorations()));
this.register(this._decorationService.onDecorationRegistered(() => this._queueRefresh()));
this.register(this._decorationService.onDecorationRemoved(decoration => this._removeDecoration(decoration)));
this.register(this._optionsService.onOptionChange(o => {
if (o === 'overviewRulerWidth') {
this.refreshDecorations();
}
}));
}
public override dispose(): void {
@@ -85,9 +90,9 @@ export class OverviewRulerRenderer extends Disposable {
}
public refreshDecorations(): void {
this._canvas.style.width = `${this._canvas.width || ScrollbarConstants.WIDTH}px`;
this._canvas.style.width = `${this._optionsService.options.overviewRulerWidth || ScrollbarConstants.WIDTH}px`;
this._canvas.style.height = `${this._screenElement.clientHeight}px`;
this._canvas.width = Math.floor((this._canvas.width || ScrollbarConstants.WIDTH)* window.devicePixelRatio);
this._canvas.width = Math.floor((this._optionsService.options.overviewRulerWidth || ScrollbarConstants.WIDTH)* window.devicePixelRatio);
this._canvas.height = Math.floor(this._screenElement.clientHeight * window.devicePixelRatio);
for (const decoration of this._decorationService.decorations) {