mirror of
https://github.com/atom/atom.git
synced 2026-01-25 23:08:18 -05:00
🎨
This commit is contained in:
@@ -191,17 +191,17 @@ describe "TextEditorPresenter", ->
|
||||
expect(stateFn(presenter).tiles[6].top).toBe((20 + 40) + (20 + 30) + 20 + 1)
|
||||
expect(stateFn(presenter).tiles[8]).toBeUndefined()
|
||||
|
||||
presenter.setScrollTop(21)
|
||||
presenter.setScrollTop(22)
|
||||
|
||||
expect(stateFn(presenter).tiles[0]).toBeUndefined()
|
||||
expect(stateFn(presenter).tiles[2].height).toBe(20 + 30)
|
||||
expect(stateFn(presenter).tiles[2].top).toBe(0)
|
||||
expect(stateFn(presenter).tiles[2].top).toBe(-1)
|
||||
expect(stateFn(presenter).tiles[4].height).toBe(20 + 40)
|
||||
expect(stateFn(presenter).tiles[4].top).toBe(30 + 20)
|
||||
expect(stateFn(presenter).tiles[4].top).toBe(30 + 20 - 1)
|
||||
expect(stateFn(presenter).tiles[6].height).toBe(20)
|
||||
expect(stateFn(presenter).tiles[6].top).toBe((20 + 40) + (20 + 30))
|
||||
expect(stateFn(presenter).tiles[6].top).toBe((20 + 40) + (20 + 30) - 1)
|
||||
expect(stateFn(presenter).tiles[8].height).toBe(20)
|
||||
expect(stateFn(presenter).tiles[8].top).toBe((20 + 40) + (20 + 30) + 20)
|
||||
expect(stateFn(presenter).tiles[8].top).toBe((20 + 40) + (20 + 30) + 20 - 1)
|
||||
expect(stateFn(presenter).tiles[10]).toBeUndefined()
|
||||
|
||||
it "includes state for all tiles if no external ::explicitHeight is assigned", ->
|
||||
|
||||
@@ -76,7 +76,7 @@ class LineTopIndex {
|
||||
return this.topPixelPositionForRow(row + 1) - this.defaultLineHeight
|
||||
}
|
||||
|
||||
rowForTopPixelPosition (top, roundingStrategy='round') {
|
||||
rowForTopPixelPosition (top, roundingStrategy='floor') {
|
||||
let blocksHeight = 0
|
||||
let lastRow = 0
|
||||
let lastTop = 0
|
||||
@@ -84,7 +84,7 @@ class LineTopIndex {
|
||||
let nextBlocksHeight = blocksHeight + block.height
|
||||
let linesHeight = block.row * this.defaultLineHeight
|
||||
if (nextBlocksHeight + linesHeight > top) {
|
||||
while (lastRow < block.row && lastTop + this.defaultLineHeight / 2 < top) {
|
||||
while (lastRow < block.row && lastTop + this.defaultLineHeight < top) {
|
||||
lastTop += this.defaultLineHeight
|
||||
lastRow++
|
||||
}
|
||||
@@ -99,8 +99,6 @@ class LineTopIndex {
|
||||
let remainingHeight = Math.max(0, top - lastTop)
|
||||
let remainingRows = Math.min(this.maxRow, lastRow + remainingHeight / this.defaultLineHeight)
|
||||
switch (roundingStrategy) {
|
||||
case "round":
|
||||
return Math.round(remainingRows)
|
||||
case "floor":
|
||||
return Math.floor(remainingRows)
|
||||
case "ceil":
|
||||
|
||||
Reference in New Issue
Block a user