Use presenter’s scrollingVertically property to defer line measurement

This commit is contained in:
Nathan Sobo 2015-01-27 11:02:46 -07:00
parent d4517b1ab0
commit b21b9c3402
2 changed files with 4 additions and 6 deletions

View File

@ -70,12 +70,12 @@ LinesComponent = React.createClass
@overlayManager = new OverlayManager(@getDOMNode())
componentDidUpdate: ->
{visible, scrollingVertically, presenter} = @props
{visible, presenter} = @props
return unless presenter?
@removeLineNodes() unless @oldState?.content.indentGuidesVisible is @newState?.content.indentGuidesVisible
@updateLineNodes()
@measureCharactersInNewLines() if visible and not scrollingVertically
@measureCharactersInNewLines() if visible and not presenter.state.scrollingVertically
@overlayManager?.render(@props)

View File

@ -33,7 +33,6 @@ TextEditorComponent = React.createClass
updateRequestedWhilePaused: false
cursorMoved: false
selectionChanged: false
scrollingVertically: false
mouseWheelScreenRow: null
mouseWheelScreenRowClearDelay: 150
scrollSensitivity: 0.4
@ -100,7 +99,7 @@ TextEditorComponent = React.createClass
LinesComponent {
ref: 'lines', @presenter, editor, hostElement, @useHardwareAcceleration, useShadowDOM,
@scrollingVertically, mouseWheelScreenRow, visible, placeholderText, @backgroundColor
mouseWheelScreenRow, visible, placeholderText, @backgroundColor
}
ScrollbarComponent
@ -215,6 +214,7 @@ TextEditorComponent = React.createClass
lineOverdrawMargin: lineOverdrawMargin
cursorBlinkPeriod: cursorBlinkPeriod
cursorBlinkResumeDelay: cursorBlinkResumeDelay
stoppedScrollingDelay: 200
backgroundColor: @backgroundColor
@presenter.onDidUpdateState(@requestUpdate)
@ -610,7 +610,6 @@ TextEditorComponent = React.createClass
@requestUpdate()
onScrollTopChanged: ->
@scrollingVertically = true
@presenter?.setScrollTop(@props.editor.getScrollTop())
@requestUpdate()
@onStoppedScrollingAfterDelay ?= debounce(@onStoppedScrolling, 200)
@ -623,7 +622,6 @@ TextEditorComponent = React.createClass
onStoppedScrolling: ->
return unless @isMounted()
@scrollingVertically = false
@mouseWheelScreenRow = null
@requestUpdate()