mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Call onScroll with the current scrollTop/Left in ScrollbarComponent
This commit is contained in:
@@ -308,9 +308,10 @@ EditorCompont = React.createClass
|
||||
editor.selectLeft() if replaceLastCharacter
|
||||
editor.insertText(char)
|
||||
|
||||
onVerticalScroll: ->
|
||||
scrollTop = @refs.verticalScrollbar.getDOMNode().scrollTop
|
||||
return if @props.editor.getScrollTop() is scrollTop
|
||||
onVerticalScroll: (scrollTop) ->
|
||||
{editor} = @props
|
||||
|
||||
return if scrollTop is editor.getScrollTop()
|
||||
|
||||
animationFramePending = @pendingScrollTop?
|
||||
@pendingScrollTop = scrollTop
|
||||
@@ -319,9 +320,10 @@ EditorCompont = React.createClass
|
||||
@props.editor.setScrollTop(@pendingScrollTop)
|
||||
@pendingScrollTop = null
|
||||
|
||||
onHorizontalScroll: ->
|
||||
scrollLeft = @refs.horizontalScrollbar.getDOMNode().scrollLeft
|
||||
return if @props.editor.getScrollLeft() is scrollLeft
|
||||
onHorizontalScroll: (scrollLeft) ->
|
||||
{editor} = @props
|
||||
|
||||
return if scrollLeft is editor.getScrollLeft()
|
||||
|
||||
animationFramePending = @pendingScrollLeft?
|
||||
@pendingScrollLeft = scrollLeft
|
||||
|
||||
@@ -7,9 +7,9 @@ ScrollbarComponent = React.createClass
|
||||
lastScrollLeft: null
|
||||
|
||||
render: ->
|
||||
{orientation, className, onScroll, scrollHeight, scrollWidth} = @props
|
||||
{orientation, className, scrollHeight, scrollWidth} = @props
|
||||
|
||||
div {className, onScroll},
|
||||
div {className, @onScroll},
|
||||
switch orientation
|
||||
when 'vertical'
|
||||
div className: 'scrollbar-content', style: {height: scrollHeight}
|
||||
@@ -35,3 +35,13 @@ ScrollbarComponent = React.createClass
|
||||
unless scrollLeft is @lastScrollLeft
|
||||
node.scrollLeft = scrollLeft
|
||||
@lastScrollLeft = node.scrollLeft
|
||||
|
||||
onScroll: ->
|
||||
{orientation, onScroll} = @props
|
||||
node = @getDOMNode()
|
||||
|
||||
switch orientation
|
||||
when 'vertical'
|
||||
onScroll(node.scrollTop)
|
||||
when 'horizontal'
|
||||
onScroll(node.scrollLeft)
|
||||
|
||||
Reference in New Issue
Block a user