Refactor to unify computations related to tiles

This commit is contained in:
Nathan Sobo
2017-03-06 15:29:01 -07:00
committed by Antonio Scandurra
parent 09f8a52b9d
commit aade501040
2 changed files with 35 additions and 32 deletions

View File

@@ -527,10 +527,8 @@ function clientLeftForCharacter (component, row, column) {
function lineNumberNodeForScreenRow (component, row) {
const gutterElement = component.refs.lineNumberGutter.element
const endRow = Math.min(component.getRenderedEndRow(), component.getModel().getApproximateScreenLineCount())
const visibleTileCount = Math.ceil((endRow - component.getRenderedStartRow()) / component.getRowsPerTile())
const tileStartRow = component.getTileStartRow(row)
const tileIndex = (tileStartRow / component.getRowsPerTile()) % visibleTileCount
const tileStartRow = component.tileStartRowForRow(row)
const tileIndex = component.tileIndexForTileStartRow(tileStartRow)
return gutterElement.children[tileIndex].children[row - tileStartRow]
}