本文整理汇总了TypeScript中vs/editor/browser/editorBrowser.IRenderingContext.linesVisibleRangesForRange方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IRenderingContext.linesVisibleRangesForRange方法的具体用法?TypeScript IRenderingContext.linesVisibleRangesForRange怎么用?TypeScript IRenderingContext.linesVisibleRangesForRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/editor/browser/editorBrowser.IRenderingContext
的用法示例。
在下文中一共展示了IRenderingContext.linesVisibleRangesForRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _renderNormalDecorations
private _renderNormalDecorations(ctx:IRenderingContext, decorations:editorCommon.IModelDecoration[], output: IRenderResult): void {
let lineHeight = String(this._context.configuration.editor.lineHeight);
for (let i = 0, lenI = decorations.length; i < lenI; i++) {
let d = decorations[i];
if (d.options.isWholeLine) {
continue;
}
let linesVisibleRanges = ctx.linesVisibleRangesForRange(d.range, false);
if (!linesVisibleRanges) {
continue;
}
let className = d.options.className;
for (let j = 0, lenJ = linesVisibleRanges.length; j < lenJ; j++) {
let lineVisibleRanges = linesVisibleRanges[j];
let strLineNumber = String(lineVisibleRanges.lineNumber);
let lineOutput: string[];
if (output.hasOwnProperty(strLineNumber)) {
lineOutput = output[strLineNumber];
} else {
lineOutput = [];
output[strLineNumber] = lineOutput;
}
for (let k = 0, lenK = lineVisibleRanges.ranges.length; k < lenK; k++) {
let visibleRange = lineVisibleRanges.ranges[k];
lineOutput.push('<div class="cdr ');
lineOutput.push(className);
lineOutput.push('" style="left:');
lineOutput.push(String(visibleRange.left));
lineOutput.push('px;width:');
lineOutput.push(String(visibleRange.width));
lineOutput.push('px;height:');
lineOutput.push(lineHeight);
lineOutput.push('px;"></div>');
}
}
}
}
示例2: _renderNormalDecorations
private _renderNormalDecorations(ctx:IRenderingContext, decorations:editorCommon.IModelDecoration[], output: string[]): void {
let lineHeight = String(this._lineHeight);
let visibleStartLineNumber = ctx.visibleRange.startLineNumber;
for (let i = 0, lenI = decorations.length; i < lenI; i++) {
let d = decorations[i];
if (d.options.isWholeLine) {
continue;
}
let linesVisibleRanges = ctx.linesVisibleRangesForRange(d.range, false);
if (!linesVisibleRanges) {
continue;
}
let className = d.options.className;
for (let j = 0, lenJ = linesVisibleRanges.length; j < lenJ; j++) {
let lineVisibleRanges = linesVisibleRanges[j];
let lineIndex = lineVisibleRanges.lineNumber - visibleStartLineNumber;
for (let k = 0, lenK = lineVisibleRanges.ranges.length; k < lenK; k++) {
let visibleRange = lineVisibleRanges.ranges[k];
let decorationOutput = (
'<div class="cdr '
+ className
+ '" style="left:'
+ String(visibleRange.left)
+ 'px;width:'
+ String(visibleRange.width)
+ 'px;height:'
+ lineHeight
+ 'px;"></div>'
);
output[lineIndex] += decorationOutput;
}
}
}
}