🎨 tileId -> tileRow

This commit is contained in:
Antonio Scandurra
2015-05-13 12:44:06 +02:00
parent 467f4a30d7
commit 25acaf26c1
3 changed files with 16 additions and 16 deletions

View File

@@ -782,7 +782,7 @@ describe "TextEditorPresenter", ->
expect(presenter.getState().content.tiles[6]).toBeDefined()
expect(presenter.getState().content.tiles[8]).toBeUndefined()
presenter.setScrollingTileId(0)
presenter.setScrollingTileRow(0)
expectStateUpdate presenter, -> presenter.setScrollTop(4)
expect(presenter.getState().content.tiles[0]).toBeDefined()
@@ -799,7 +799,7 @@ describe "TextEditorPresenter", ->
# should clear ::mouseWheelScreenRow after stoppedScrollingDelay elapses even if we don't scroll first
presenter.setScrollingTileId(4)
presenter.setScrollingTileRow(4)
advanceClock(200)
expectStateUpdate presenter, -> presenter.setScrollTop(6)
expect(presenter.getState().content.tiles[4]).toBeUndefined()
@@ -807,7 +807,7 @@ describe "TextEditorPresenter", ->
it "does not preserve deleted on-screen tiles even if they correspond to ::scrollingTileId", ->
presenter = buildPresenter(explicitHeight: 6, scrollTop: 0, lineHeight: 1, tileCount: 3, stoppedScrollingDelay: 200)
presenter.setScrollingTileId(2)
presenter.setScrollingTileRow(2)
expectStateUpdate presenter, -> editor.setText("")

View File

@@ -354,7 +354,7 @@ class TextEditorComponent
event.preventDefault() unless previousScrollLeft is @presenter.getScrollLeft()
else
# Scrolling vertically
@presenter.setScrollingTileId(@tileIdForNode(event.target))
@presenter.setScrollingTileRow(@tileRowForNode(event.target))
previousScrollTop = @presenter.getScrollTop()
@presenter.setScrollTop(previousScrollTop - Math.round(wheelDeltaY * @scrollSensitivity))
event.preventDefault() unless previousScrollTop is @presenter.getScrollTop()
@@ -729,7 +729,7 @@ class TextEditorComponent
lineNumberNodeForScreenRow: (screenRow) -> @gutterContainerComponent.getLineNumberGutterComponent().lineNumberNodeForScreenRow(screenRow)
tileIdForNode: (node) ->
tileRowForNode: (node) ->
while node?
if tileId = node.dataset.tileId
return tileId

View File

@@ -304,10 +304,10 @@ class TextEditorPresenter
tileForRow: (row) ->
row - (row % @tileSize)
isValidTile: (tileId) ->
return false unless tileId?
isValidTile: (tileRow) ->
return false unless tileRow?
tileId <= @tileForRow(@model.getLastScreenRow())
tileRow <= @tileForRow(@model.getLastScreenRow())
getVisibleTilesRange: ->
startTileRow = Math.max(0, @tileForRow(@startRow))
@@ -335,9 +335,9 @@ class TextEditorPresenter
visibleTiles[startRow] = true
if @isValidTile(@scrollingTileId) and not visibleTiles[@scrollingTileId]?
@state.content.tiles[@scrollingTileId].display = "none"
visibleTiles[@scrollingTileId] = true
if @isValidTile(@scrollingTileRow) and not visibleTiles[@scrollingTileRow]?
@state.content.tiles[@scrollingTileRow].display = "none"
visibleTiles[@scrollingTileRow] = true
for id, tile of @state.content.tiles
continue if visibleTiles.hasOwnProperty(id)
@@ -779,8 +779,8 @@ class TextEditorPresenter
didStopScrolling: ->
@state.content.scrollingVertically = false
if @scrollingTileId?
@scrollingTileId = null
if @scrollingTileRow?
@scrollingTileRow = null
@shouldUpdateTilesState = true
@shouldUpdateLineNumbersState = true
@shouldUpdateCustomGutterDecorationState = true
@@ -946,9 +946,9 @@ class TextEditorPresenter
@emitDidUpdateState()
setScrollingTileId: (tileId) ->
if @scrollingTileId isnt tileId
@scrollingTileId = tileId
setScrollingTileRow: (tileRow) ->
if @scrollingTileRow isnt tileRow
@scrollingTileRow = tileRow
@didStartScrolling()
setBaseCharacterWidth: (baseCharacterWidth) ->