本文整理汇总了TypeScript中vs/editor/common/viewLayout/verticalObjects.VerticalObjects.getVerticalOffsetForLineNumber方法的典型用法代码示例。如果您正苦于以下问题:TypeScript VerticalObjects.getVerticalOffsetForLineNumber方法的具体用法?TypeScript VerticalObjects.getVerticalOffsetForLineNumber怎么用?TypeScript VerticalObjects.getVerticalOffsetForLineNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/editor/common/viewLayout/verticalObjects.VerticalObjects
的用法示例。
在下文中一共展示了VerticalObjects.getVerticalOffsetForLineNumber方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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);
});
示例2: getVerticalOffsetForLineNumber
/**
* Get the vertical offset (the sum of heights for all objects above) a certain line number.
*
* @param lineNumber The line number
* @return The sum of heights for all objects above `lineNumber`.
*/
public getVerticalOffsetForLineNumber(lineNumber:number): number {
return this.verticalObjects.getVerticalOffsetForLineNumber(lineNumber, this._lineHeight);
}
示例3: getVerticalOffsetForLineNumber
/**
* Get the vertical offset (the sum of heights for all objects above) a certain line number.
*
* @param lineNumber The line number
* @return The sum of heights for all objects above `lineNumber`.
*/
public getVerticalOffsetForLineNumber(lineNumber:number): number {
return this.verticalObjects.getVerticalOffsetForLineNumber(lineNumber, this.configuration.editor.lineHeight);
}