当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript IRenderingContext.linesVisibleRangesForRange方法代码示例

本文整理汇总了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>');
				}
			}
		}
	}
开发者ID:1424667164,项目名称:vscode,代码行数:43,代码来源:decorations.ts

示例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;
				}
			}
		}
	}
开发者ID:AnilVarmaBiruduraju,项目名称:vscode,代码行数:38,代码来源:decorations.ts


注:本文中的vs/editor/browser/editorBrowser.IRenderingContext.linesVisibleRangesForRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。