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


TypeScript verticalObjects.VerticalObjects类代码示例

本文整理汇总了TypeScript中vs/editor/common/viewLayout/verticalObjects.VerticalObjects的典型用法代码示例。如果您正苦于以下问题:TypeScript VerticalObjects类的具体用法?TypeScript VerticalObjects怎么用?TypeScript VerticalObjects使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: constructor

	constructor(configuration: editorCommon.IConfiguration, lineCount: number) {
		this.configuration = configuration;
		this._lineHeight = this.configuration.editor.lineHeight;
		this._scrollBeyondLastLine = this.configuration.editor.viewInfo.scrollBeyondLastLine;

		this.verticalObjects = new VerticalObjects();
		this.verticalObjects.replaceLines(lineCount);
	}
开发者ID:pk-codebox-evo,项目名称:ide-microsoft-vscode,代码行数:8,代码来源:linesLayout.ts

示例2: constructor

	constructor(configuration: editorCommon.IConfiguration, model:IViewModel) {
		this.configuration = configuration;
		this._lineHeight = this.configuration.editor.lineHeight;
		this._scrollBeyondLastLine = this.configuration.editor.viewInfo.scrollBeyondLastLine;

		this.model = model;
		this.verticalObjects = new VerticalObjects();
		this.verticalObjects.replaceLines(model.getLineCount());
	}
开发者ID:GYGit,项目名称:vscode,代码行数:9,代码来源:linesLayout.ts

示例3: test

	test('VerticalObjects getLineNumberAtOrAfterVerticalOffset', () => {
		var verticalObjects = new VerticalObjects();
		verticalObjects.replaceLines(10);
		verticalObjects.insertWhitespace(6, 0, 10);

		// 10 lines
		// whitespace: - a(6,10)
		assert.equal(verticalObjects.getTotalHeight(1), 20);
		assert.equal(verticalObjects.getVerticalOffsetForLineNumber(1, 1), 0);
		assert.equal(verticalObjects.getVerticalOffsetForLineNumber(2, 1), 1);
		assert.equal(verticalObjects.getVerticalOffsetForLineNumber(3, 1), 2);
		assert.equal(verticalObjects.getVerticalOffsetForLineNumber(4, 1), 3);
		assert.equal(verticalObjects.getVerticalOffsetForLineNumber(5, 1), 4);
		assert.equal(verticalObjects.getVerticalOffsetForLineNumber(6, 1), 5);
		assert.equal(verticalObjects.getVerticalOffsetForLineNumber(7, 1), 16);
		assert.equal(verticalObjects.getVerticalOffsetForLineNumber(8, 1), 17);
		assert.equal(verticalObjects.getVerticalOffsetForLineNumber(9, 1), 18);
		assert.equal(verticalObjects.getVerticalOffsetForLineNumber(10, 1), 19);

		// Do some hit testing
		// line      [1, 2, 3, 4, 5, 6,  7,  8,  9, 10]
		// vertical: [0, 1, 2, 3, 4, 5, 16, 17, 18, 19]
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(-100, 1), 1);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(-1, 1), 1);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(0, 1), 1);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(1, 1), 2);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(2, 1), 3);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(3, 1), 4);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(4, 1), 5);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(5, 1), 6);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(6, 1), 7);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(7, 1), 7);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(8, 1), 7);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(9, 1), 7);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(10, 1), 7);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(11, 1), 7);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(12, 1), 7);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(13, 1), 7);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(14, 1), 7);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(15, 1), 7);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(16, 1), 7);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(17, 1), 8);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(18, 1), 9);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(19, 1), 10);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(20, 1), 10);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(21, 1), 10);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(22, 1), 10);
		assert.equal(verticalObjects.getLineNumberAtOrAfterVerticalOffset(23, 1), 10);
	});
开发者ID:pk-codebox-evo,项目名称:ide-microsoft-vscode,代码行数:49,代码来源:verticalObjects.test.ts

示例4: getLinesViewportData

	/**
	 * Get all the lines and their relative vertical offsets that are positioned inside `viewport`.
	 *
	 * @param viewport The viewport.
	 * @return A structure describing the lines positioned between `verticalOffset1` and `verticalOffset2`.
	 */
	public getLinesViewportData(visibleBox:editorCommon.IViewport): editorCommon.IViewLinesViewportData {

		var viewportData = this.verticalObjects.getLinesViewportData(visibleBox.top, visibleBox.top + visibleBox.height, this.configuration.editor.lineHeight);

		var decorationsResolver = this.model.getDecorationsResolver(viewportData.startLineNumber, viewportData.endLineNumber);
		viewportData.getDecorationsInViewport = () => decorationsResolver.getDecorations();
		viewportData.getInlineDecorationsForLineInViewport = (lineNumber:number) => decorationsResolver.getInlineDecorations(lineNumber);

		return viewportData;
	}
开发者ID:578723746,项目名称:vscode,代码行数:16,代码来源:linesLayout.ts

示例5: getLinesViewportData

	/**
	 * Get all the lines and their relative vertical offsets that are positioned inside `viewport`.
	 *
	 * @param viewport The viewport.
	 * @return A structure describing the lines positioned between `verticalOffset1` and `verticalOffset2`.
	 */
	public getLinesViewportData(visibleBox:editorCommon.Viewport): ViewLinesViewportData {
		let partialData = this.verticalObjects.getLinesViewportData(visibleBox.top, visibleBox.top + visibleBox.height, this._lineHeight);
		let decorationsData = this.model.getDecorationsViewportData(partialData.startLineNumber, partialData.endLineNumber);
		let visibleRange = new Range(
			partialData.startLineNumber,
			1,
			partialData.endLineNumber,
			this.model.getLineMaxColumn(partialData.endLineNumber)
		);

		return new ViewLinesViewportData(partialData, visibleRange, decorationsData);
	}
开发者ID:Clizhuowei,项目名称:vscode,代码行数:18,代码来源:linesLayout.ts

示例6: getLinesViewportData

	/**
	 * Get all the lines and their relative vertical offsets that are positioned inside `viewport`.
	 *
	 * @param viewport The viewport.
	 * @return A structure describing the lines positioned between `verticalOffset1` and `verticalOffset2`.
	 */
	public getLinesViewportData(visibleBox:editorCommon.Viewport): ViewLinesViewportData {
		let partialData = this.verticalObjects.getLinesViewportData(visibleBox.top, visibleBox.top + visibleBox.height, this._lineHeight);
		let decorationsData = this.model.getDecorationsViewportData(partialData.startLineNumber, partialData.endLineNumber);
		let visibleRange = new Range(
			partialData.startLineNumber,
			1,
			partialData.endLineNumber,
			this.model.getLineMaxColumn(partialData.endLineNumber)
		);

		let startLineNumber =  partialData.startLineNumber === partialData.endLineNumber || partialData.relativeVerticalOffset[0] >= partialData.viewportTop ? partialData.startLineNumber : partialData.startLineNumber + 1;
		let endLineNumber = partialData.relativeVerticalOffset[partialData.relativeVerticalOffset.length - 1] + this._lineHeight <= partialData.viewportTop + partialData.viewportHeight ? partialData.endLineNumber : partialData.endLineNumber - 1;
		let visibleRangeWithCompleteLines = new Range(
			startLineNumber,
			1,
			endLineNumber,
			this.model.getLineMaxColumn(endLineNumber)
		);

		return new ViewLinesViewportData(partialData, visibleRange, visibleRangeWithCompleteLines, decorationsData);
	}
开发者ID:GYGit,项目名称:vscode,代码行数:27,代码来源:linesLayout.ts

示例7: getWhitespaceViewportData

	/**
	 * Get a list of whitespaces that are positioned inside `viewport`.
	 *
	 * @param viewport The viewport.
	 * @return An array with all the whitespaces in the viewport. If no whitespace is in viewport, the array is empty.
	 */
	public getWhitespaceViewportData(visibleBox:editorCommon.Viewport): editorCommon.IViewWhitespaceViewportData[] {
		return this.verticalObjects.getWhitespaceViewportData(visibleBox.top, visibleBox.top + visibleBox.height, this._lineHeight);
	}
开发者ID:GYGit,项目名称:vscode,代码行数:9,代码来源:linesLayout.ts

示例8: getLineNumberAtOrAfterVerticalOffset

	/**
	 * Find the first line number that is at or after vertical offset `verticalOffset`.
	 * i.e. if getVerticalOffsetForLine(line) is x and getVerticalOffsetForLine(line + 1) is y, then
	 * getLineNumberAtOrAfterVerticalOffset(i) = line, x <= i < y.
	 *
	 * @param verticalOffset The vertical offset to search at.
	 * @return The line number at or after vertical offset `verticalOffset`.
	 */
	public getLineNumberAtOrAfterVerticalOffset(verticalOffset:number): number {
		return this.verticalObjects.getLineNumberAtOrAfterVerticalOffset(verticalOffset, this._lineHeight);
	}
开发者ID:GYGit,项目名称:vscode,代码行数:11,代码来源:linesLayout.ts

示例9: onModelFlushed

	/**
	 * Event handler, call when the model associated to this view has been flushed.
	 */
	public onModelFlushed(): void {
		this.verticalObjects.replaceLines(this.model.getLineCount());
	}
开发者ID:GYGit,项目名称:vscode,代码行数:6,代码来源:linesLayout.ts

示例10: changeWhitespace

	public changeWhitespace(id:number, newAfterLineNumber:number, newHeight:number): boolean {
		return this.verticalObjects.changeWhitespace(id, newAfterLineNumber, newHeight);
	}
开发者ID:GYGit,项目名称:vscode,代码行数:3,代码来源:linesLayout.ts


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