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


TypeScript IRenderingContext.lineIsVisible方法代码示例

本文整理汇总了TypeScript中vs/editor/browser/editorBrowser.IRenderingContext.lineIsVisible方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IRenderingContext.lineIsVisible方法的具体用法?TypeScript IRenderingContext.lineIsVisible怎么用?TypeScript IRenderingContext.lineIsVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vs/editor/browser/editorBrowser.IRenderingContext的用法示例。


在下文中一共展示了IRenderingContext.lineIsVisible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: _renderWholeLineDecorations

	private _renderWholeLineDecorations(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 decorationOutput = [
				'<div class="cdr ',
				d.options.className,
				'" style="left:0;width:100%;height:',
				lineHeight,
				'px;"></div>'
			].join('');

			let startLineNumber = d.range.startLineNumber;
			let endLineNumber = d.range.endLineNumber;
			for (let j = startLineNumber; j <= endLineNumber; j++) {
				if (!ctx.lineIsVisible(j)) {
					continue;
				}

				let strLineNumber = String(j);
				if (output.hasOwnProperty(strLineNumber)) {
					output[strLineNumber].push(decorationOutput);
				} else {
					output[strLineNumber] = [decorationOutput];
				}
			}
		}
	}
开发者ID:1424667164,项目名称:vscode,代码行数:34,代码来源:decorations.ts

示例2: shouldCallRender2

	public shouldCallRender2(ctx:IRenderingContext): boolean {
		if (!this.shouldRender) {
			return false;
		}
		this.shouldRender = false;

		if (!this._context.configuration.editor.glyphMargin) {
			this._renderResult = null;
			return false;
		}

		var output: IRenderResult = {};
		var count = 0;

		var decorations = ctx.getDecorationsInViewport(),
			lineHeight = this._context.configuration.editor.lineHeight.toString(),
			d:editorCommon.IModelDecoration,
			rng:editorCommon.IRange,
			i:number, lenI:number,
			classNames:{[lineNumber:string]:{[className:string]:boolean;};} = {},
			lineClassNames:{[className:string]:boolean;},
			className:string,
			lineOutput:string[],
			lineNumber: number,
			lineNumberStr: string;

		for (i = 0, lenI = decorations.length; i < lenI; i++) {
			d = decorations[i];
			if (!d.options.glyphMarginClassName) {
				continue;
			}

			rng = d.range;
			for (lineNumber = rng.startLineNumber; lineNumber <= rng.endLineNumber; lineNumber++) {
				if (!ctx.lineIsVisible(lineNumber)) {
					continue;
				}

				lineNumberStr = lineNumber.toString();

				if (!classNames.hasOwnProperty(lineNumberStr)) {
					classNames[lineNumberStr] = {};
				}
				classNames[lineNumberStr][d.options.glyphMarginClassName] = true;
			}
		}

		var left = this._glyphMarginLeft.toString(),
			width = this._glyphMarginWidth.toString();

		var common = '" style="left:' + left + 'px;width:' + width + 'px' + ';height:' + lineHeight + 'px;"></div>';

		for (lineNumberStr in classNames) {
			lineClassNames = classNames[lineNumberStr];
			lineOutput = [];
			lineOutput.push('<div class="cgmr');
			for (className in lineClassNames) {
				// Count one more glyph
				count++;
				lineOutput.push(' ');
				lineOutput.push(className);
			}
			lineOutput.push(common);
			output[lineNumberStr] = lineOutput;
		}

		this._renderResult = output;

		return true;
	}
开发者ID:1424667164,项目名称:vscode,代码行数:70,代码来源:glyphMargin.ts


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