mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Use presenter’s scrollTop/scrollLeft in LinesComponent
This commit is contained in:
@@ -27,7 +27,7 @@ LinesComponent = React.createClass
|
||||
|
||||
{scrollWidth, scrollHeight} = @newState
|
||||
{lineHeightInPixels, defaultCharWidth, scrollViewHeight, scopedCharacterWidthsChangeCount} = @props
|
||||
{scrollTop, scrollLeft, cursorPixelRects} = @props
|
||||
{cursorPixelRects} = @props
|
||||
style =
|
||||
height: Math.max(scrollHeight, scrollViewHeight)
|
||||
width: scrollWidth
|
||||
@@ -48,7 +48,8 @@ LinesComponent = React.createClass
|
||||
}
|
||||
|
||||
getTransform: ->
|
||||
{scrollTop, scrollLeft, useHardwareAcceleration} = @props
|
||||
{scrollTop, scrollLeft} = @newState
|
||||
{useHardwareAcceleration} = @props
|
||||
|
||||
if useHardwareAcceleration
|
||||
"translate3d(#{-scrollLeft}px, #{-scrollTop}px, 0px)"
|
||||
|
||||
@@ -232,6 +232,7 @@ TextEditorComponent = React.createClass
|
||||
clientHeight: editor.getHeight()
|
||||
clientWidth: editor.getWidth()
|
||||
scrollTop: editor.getScrollTop()
|
||||
scrollLeft: editor.getScrollLeft()
|
||||
lineHeight: editor.getLineHeightInPixels()
|
||||
baseCharacterWidth: editor.getDefaultCharWidth()
|
||||
lineOverdrawMargin: lineOverdrawMargin
|
||||
@@ -393,7 +394,7 @@ TextEditorComponent = React.createClass
|
||||
@subscribe editor.onDidChangeCharacterWidths(@onCharacterWidthsChanged)
|
||||
@subscribe editor.onDidChangePlaceholderText(@onPlaceholderTextChanged)
|
||||
@subscribe editor.$scrollTop.changes, @onScrollTopChanged
|
||||
@subscribe editor.$scrollLeft.changes, @requestUpdate
|
||||
@subscribe editor.$scrollLeft.changes, @onScrollLeftChanged
|
||||
@subscribe editor.$verticalScrollbarWidth.changes, @requestUpdate
|
||||
@subscribe editor.$horizontalScrollbarHeight.changes, @requestUpdate
|
||||
@subscribe editor.$height.changes, @requestUpdate
|
||||
@@ -530,6 +531,7 @@ TextEditorComponent = React.createClass
|
||||
unless animationFramePending
|
||||
@requestAnimationFrame =>
|
||||
@props.editor.setScrollLeft(@pendingScrollLeft)
|
||||
@presenter?.setScrollLeft(@pendingScrollLeft)
|
||||
@pendingScrollLeft = null
|
||||
|
||||
onMouseWheel: (event) ->
|
||||
@@ -725,6 +727,10 @@ TextEditorComponent = React.createClass
|
||||
@onStoppedScrollingAfterDelay ?= debounce(@onStoppedScrolling, 200)
|
||||
@onStoppedScrollingAfterDelay()
|
||||
|
||||
onScrollLeftChanged: ->
|
||||
@presenter?.setScrollLeft(@props.editor.getScrollLeft())
|
||||
@requestUpdate()
|
||||
|
||||
onStoppedScrolling: ->
|
||||
return unless @isMounted()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user