mirror of
https://github.com/atom/atom.git
synced 2026-01-25 14:59:03 -05:00
Keep scrolling tile around for mousewheel
This commit is contained in:
@@ -354,7 +354,6 @@ class TextEditorComponent
|
||||
event.preventDefault() unless previousScrollLeft is @presenter.getScrollLeft()
|
||||
else
|
||||
# Scrolling vertically
|
||||
@presenter.setMouseWheelScreenRow(@screenRowForNode(event.target))
|
||||
previousScrollTop = @presenter.getScrollTop()
|
||||
@presenter.setScrollTop(previousScrollTop - Math.round(wheelDeltaY * @scrollSensitivity))
|
||||
event.preventDefault() unless previousScrollTop is @presenter.getScrollTop()
|
||||
|
||||
@@ -317,9 +317,11 @@ class TextEditorPresenter
|
||||
visibleTilesIndexes = [startIndex...endIndex]
|
||||
|
||||
for index, tile of @state.content.tiles
|
||||
unless index in visibleTilesIndexes
|
||||
delete @state.content.tiles[index]
|
||||
delete @linesPresentersByTileIndex[index]
|
||||
continue if index is @scrollingTile
|
||||
continue if index in visibleTilesIndexes
|
||||
|
||||
delete @state.content.tiles[index]
|
||||
delete @linesPresentersByTileIndex[index]
|
||||
|
||||
for index in visibleTilesIndexes
|
||||
presenter = @linesPresentersByTileIndex[index] ?= new LinesPresenter(@)
|
||||
@@ -728,8 +730,8 @@ class TextEditorPresenter
|
||||
|
||||
didStopScrolling: ->
|
||||
@state.content.scrollingVertically = false
|
||||
if @mouseWheelScreenRow?
|
||||
@mouseWheelScreenRow = null
|
||||
if @scrollingTile?
|
||||
@scrollingTile = null
|
||||
@shouldUpdateTilesState = true
|
||||
@shouldUpdateLineNumbersState = true
|
||||
@shouldUpdateCustomGutterDecorationState = true
|
||||
@@ -895,9 +897,9 @@ class TextEditorPresenter
|
||||
|
||||
@emitDidUpdateState()
|
||||
|
||||
setMouseWheelScreenRow: (mouseWheelScreenRow) ->
|
||||
unless @mouseWheelScreenRow is mouseWheelScreenRow
|
||||
@mouseWheelScreenRow = mouseWheelScreenRow
|
||||
setScrollingTile: (tileId) ->
|
||||
if @scrollingTile isnt tileId
|
||||
@scrollingTile = tileId
|
||||
@didStartScrolling()
|
||||
|
||||
setBaseCharacterWidth: (baseCharacterWidth) ->
|
||||
|
||||
@@ -21,9 +21,13 @@ class TileComponent
|
||||
@screenRowsByLineId = {}
|
||||
@lineIdsByScreenRow = {}
|
||||
@domNode = document.createElement("div")
|
||||
@domNode.addEventListener("mousewheel", @onMouseWheel)
|
||||
@domNode.style.position = "absolute"
|
||||
@domNode.classList.add("tile")
|
||||
|
||||
onMouseWheel: =>
|
||||
@presenter.setScrollingTile(@id)
|
||||
|
||||
getDomNode: ->
|
||||
@domNode
|
||||
|
||||
|
||||
Reference in New Issue
Block a user