本文整理匯總了TypeScript中vs/editor/common/viewLayout/linesLayout.LinesLayout.getVerticalOffsetForLineNumber方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript LinesLayout.getVerticalOffsetForLineNumber方法的具體用法?TypeScript LinesLayout.getVerticalOffsetForLineNumber怎麽用?TypeScript LinesLayout.getVerticalOffsetForLineNumber使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vs/editor/common/viewLayout/linesLayout.LinesLayout
的用法示例。
在下文中一共展示了LinesLayout.getVerticalOffsetForLineNumber方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test('LinesLayout getLineNumberAtOrAfterVerticalOffset', () => {
let linesLayout = new LinesLayout(10, 1);
linesLayout.insertWhitespace(6, 0, 10, 0);
// 10 lines
// whitespace: - a(6,10)
assert.equal(linesLayout.getLinesTotalHeight(), 20);
assert.equal(linesLayout.getVerticalOffsetForLineNumber(1), 0);
assert.equal(linesLayout.getVerticalOffsetForLineNumber(2), 1);
assert.equal(linesLayout.getVerticalOffsetForLineNumber(3), 2);
assert.equal(linesLayout.getVerticalOffsetForLineNumber(4), 3);
assert.equal(linesLayout.getVerticalOffsetForLineNumber(5), 4);
assert.equal(linesLayout.getVerticalOffsetForLineNumber(6), 5);
assert.equal(linesLayout.getVerticalOffsetForLineNumber(7), 16);
assert.equal(linesLayout.getVerticalOffsetForLineNumber(8), 17);
assert.equal(linesLayout.getVerticalOffsetForLineNumber(9), 18);
assert.equal(linesLayout.getVerticalOffsetForLineNumber(10), 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(linesLayout.getLineNumberAtOrAfterVerticalOffset(-100), 1);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(-1), 1);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(0), 1);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(1), 2);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(2), 3);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(3), 4);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(4), 5);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(5), 6);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(6), 7);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(7), 7);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(8), 7);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(9), 7);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(10), 7);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(11), 7);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(12), 7);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(13), 7);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(14), 7);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(15), 7);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(16), 7);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(17), 8);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(18), 9);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(19), 10);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(20), 10);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(21), 10);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(22), 10);
assert.equal(linesLayout.getLineNumberAtOrAfterVerticalOffset(23), 10);
});
示例2: getVerticalOffsetForLineNumber
public getVerticalOffsetForLineNumber(lineNumber: number): number {
return this._linesLayout.getVerticalOffsetForLineNumber(lineNumber);
}