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


TypeScript RenderingContext.getDecorationsInViewport方法代码示例

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


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

示例1: _getDecorations

	protected _getDecorations(ctx: RenderingContext): DecorationToRender[] {
		let decorations = ctx.getDecorationsInViewport();
		let r: DecorationToRender[] = [], rLen = 0;
		for (let i = 0, len = decorations.length; i < len; i++) {
			let d = decorations[i];
			let linesDecorationsClassName = d.options.linesDecorationsClassName;
			if (linesDecorationsClassName) {
				r[rLen++] = new DecorationToRender(d.range.startLineNumber, d.range.endLineNumber, linesDecorationsClassName);
			}
		}
		return r;
	}
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:12,代码来源:linesDecorations.ts

示例2: _getDecorations

	protected _getDecorations(ctx: RenderingContext): DecorationToRender[] {
		let decorations = ctx.getDecorationsInViewport();
		let r: DecorationToRender[] = [];
		for (let i = 0, len = decorations.length; i < len; i++) {
			let d = decorations[i];
			let marginClassName = d.source.options.marginClassName;
			if (marginClassName) {
				r.push(new DecorationToRender(d.range.startLineNumber, d.range.endLineNumber, marginClassName));
			}
		}
		return r;
	}
开发者ID:Chan-PH,项目名称:vscode,代码行数:12,代码来源:marginDecorations.ts

示例3: prepareRender

	public prepareRender(ctx: RenderingContext): void {
		let _decorations = ctx.getDecorationsInViewport();

		// Keep only decorations with `className`
		let decorations: ViewModelDecoration[] = [], decorationsLen = 0;
		for (let i = 0, len = _decorations.length; i < len; i++) {
			let d = _decorations[i];
			if (d.options.className) {
				decorations[decorationsLen++] = d;
			}
		}

		// Sort decorations for consistent render output
		decorations = decorations.sort((a, b) => {
			if (a.options.zIndex! < b.options.zIndex!) {
				return -1;
			}
			if (a.options.zIndex! > b.options.zIndex!) {
				return 1;
			}
			const aClassName = a.options.className!;
			const bClassName = b.options.className!;

			if (aClassName < bClassName) {
				return -1;
			}
			if (aClassName > bClassName) {
				return 1;
			}

			return Range.compareRangesUsingStarts(a.range, b.range);
		});

		let visibleStartLineNumber = ctx.visibleRange.startLineNumber;
		let visibleEndLineNumber = ctx.visibleRange.endLineNumber;
		let output: string[] = [];
		for (let lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
			let lineIndex = lineNumber - visibleStartLineNumber;
			output[lineIndex] = '';
		}

		// Render first whole line decorations and then regular decorations
		this._renderWholeLineDecorations(ctx, decorations, output);
		this._renderNormalDecorations(ctx, decorations, output);
		this._renderResult = output;
	}
开发者ID:KTXSoftware,项目名称:KodeStudio,代码行数:46,代码来源:decorations.ts


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