Don't populate more screen rows than necessary

See 1c8847cb4f
This commit is contained in:
Antonio Scandurra
2017-05-09 16:08:48 +02:00
parent 5be2db645a
commit 7f3794b12e

View File

@@ -2670,7 +2670,8 @@ class TextEditorComponent {
// visible so we *at least* get the longest row in the visible range.
populateVisibleRowRange () {
const lastPossibleVisibleRow = this.rowForPixelPosition(this.getScrollBottom())
const maxPossibleVisibleTileCount = Math.floor((lastPossibleVisibleRow - this.getFirstVisibleRow()) / this.getRowsPerTile()) + 2
const maxPossibleVisibleRows = lastPossibleVisibleRow - this.getFirstVisibleRow()
const maxPossibleVisibleTileCount = Math.ceil(maxPossibleVisibleRows / this.getRowsPerTile()) + 1
const lastPossibleRenderedRow = this.getRenderedStartRow() + maxPossibleVisibleTileCount * this.getRowsPerTile()
this.props.model.displayLayer.populateSpatialIndexIfNeeded(Infinity, lastPossibleRenderedRow)
}