Scroll exactly as we did before tiling

Except that now we store the scrolling tile, instead of the scrolling
row.
This commit is contained in:
Antonio Scandurra
2015-05-11 09:42:04 +02:00
parent 9581202a77
commit a6e0fa6e91
3 changed files with 7 additions and 8 deletions

View File

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