Update scrollHeight/Width before scrollTop/Left in dummy scrollbars

This avoids jerky scroll behavior when auto-scrolling at the margins.
This commit is contained in:
Nathan Sobo
2015-02-19 15:19:49 -07:00
parent 1d84d74e50
commit dc752eda20

View File

@@ -40,14 +40,14 @@ class ScrollbarComponent
@domNode.style.bottom = @newState.bottom + 'px'
@oldState.bottom = @newState.bottom
if @newState.scrollTop isnt @oldState.scrollTop
@domNode.scrollTop = @newState.scrollTop
@oldState.scrollTop = @newState.scrollTop
if @newState.scrollHeight isnt @oldState.scrollHeight
@contentNode.style.height = @newState.scrollHeight + 'px'
@oldState.scrollHeight = @newState.scrollHeight
if @newState.scrollTop isnt @oldState.scrollTop
@domNode.scrollTop = @newState.scrollTop
@oldState.scrollTop = @newState.scrollTop
updateHorizontal: ->
if @newState.height isnt @oldState.height
@domNode.style.height = @newState.height + 'px'
@@ -57,13 +57,14 @@ class ScrollbarComponent
@domNode.style.right = @newState.right + 'px'
@oldState.right = @newState.right
if @newState.scrollWidth isnt @oldState.scrollWidth
@contentNode.style.width = @newState.scrollWidth + 'px'
@oldState.scrollWidth = @newState.scrollWidth
if @newState.scrollLeft isnt @oldState.scrollLeft
@domNode.scrollLeft = @newState.scrollLeft
@oldState.scrollLeft = @newState.scrollLeft
if @newState.scrollWidth isnt @oldState.scrollWidth
@contentNode.style.width = @newState.scrollWidth + 'px'
@oldState.scrollWidth = @newState.scrollWidth
onScrollCallback: =>
switch @orientation