當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。