add overviewRuler to addDecoration
This commit is contained in:
+3
-1
@@ -545,13 +545,15 @@ function loadTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addDecoration() {
|
function addDecoration() {
|
||||||
|
term.options['overviewRulerWidth'] = 15;
|
||||||
const marker = term.addMarker(1);
|
const marker = term.addMarker(1);
|
||||||
const decoration = term.registerDecoration({ marker });
|
const decoration = term.registerDecoration({ marker });
|
||||||
decoration.onRender((e) => {
|
decoration.onRender((e) => {
|
||||||
if (e.classList.value === 'xterm-decoration') {
|
if (e.classList.value === 'xterm-decoration') {
|
||||||
e.style.backgroundColor = 'red';
|
e.style.backgroundColor = '#ef2929';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
term.registerDecoration({marker, overviewRulerOptions: { color: '#ef2929'}})
|
||||||
}
|
}
|
||||||
|
|
||||||
function addOverviewRuler() {
|
function addOverviewRuler() {
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ export class OverviewRulerRenderer extends Disposable {
|
|||||||
this._queueRefresh();
|
this._queueRefresh();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
console.log(this._width/3);
|
||||||
renderSizes[SizeIndex.OUTER_SIZE] = Math.floor(this._width / 3);
|
renderSizes[SizeIndex.OUTER_SIZE] = Math.floor(this._width / 3);
|
||||||
renderSizes[SizeIndex.INNER_SIZE] = Math.ceil(this._width / 3);
|
renderSizes[SizeIndex.INNER_SIZE] = Math.ceil(this._width / 3);
|
||||||
}
|
}
|
||||||
@@ -96,7 +97,7 @@ export class OverviewRulerRenderer extends Disposable {
|
|||||||
this._ctx.strokeRect(
|
this._ctx.strokeRect(
|
||||||
!decoration.options.overviewRulerOptions.position || decoration.options.overviewRulerOptions.position === 'left' ? 0 : decoration.options.overviewRulerOptions.position === 'right' ? renderSizes[SizeIndex.OUTER_SIZE] + renderSizes[SizeIndex.INNER_SIZE]: renderSizes[SizeIndex.OUTER_SIZE],
|
!decoration.options.overviewRulerOptions.position || decoration.options.overviewRulerOptions.position === 'left' ? 0 : decoration.options.overviewRulerOptions.position === 'right' ? renderSizes[SizeIndex.OUTER_SIZE] + renderSizes[SizeIndex.INNER_SIZE]: renderSizes[SizeIndex.OUTER_SIZE],
|
||||||
Math.round(this._canvas.height * (decoration.options.marker.line / this._bufferService.buffers.active.lines.length)),
|
Math.round(this._canvas.height * (decoration.options.marker.line / this._bufferService.buffers.active.lines.length)),
|
||||||
!decoration.options.overviewRulerOptions.position ? this._width : decoration.options.overviewRulerOptions.position === 'center' ? renderSizes[SizeIndex.INNER_SIZE] : renderSizes[SizeIndex.OUTER_SIZE],
|
!decoration.options.overviewRulerOptions.position ? this._width : decoration.options.overviewRulerOptions.position === 'center' ? renderSizes[SizeIndex.INNER_SIZE]: renderSizes[SizeIndex.OUTER_SIZE],
|
||||||
window.devicePixelRatio
|
window.devicePixelRatio
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user