From dc752eda200725b49e1d04c51355ed0db49a952e Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 19 Feb 2015 15:19:49 -0700 Subject: [PATCH] Update scrollHeight/Width before scrollTop/Left in dummy scrollbars This avoids jerky scroll behavior when auto-scrolling at the margins. --- src/scrollbar-component.coffee | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/scrollbar-component.coffee b/src/scrollbar-component.coffee index 8eef5c3e6..3e94a0708 100644 --- a/src/scrollbar-component.coffee +++ b/src/scrollbar-component.coffee @@ -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