Don't pause overflowchanged events after React editor updates

Fixes #2237

Previously, operations such as typing and scrolling were triggering
overflowchanged events on the editor, which concerned me because we
were performing lots of unnecessary measurements of the scroll view.
Now that we draw extra lines above and below the visible screen row
range, this doesn't happen, so we can remove this pausing code which
was delaying the resizing of the editor in certain situations.
This commit is contained in:
Nathan Sobo
2014-06-11 12:06:59 -06:00
parent 32245b1d92
commit 1b4426e3ba

View File

@@ -34,8 +34,6 @@ EditorComponent = React.createClass
mouseWheelScreenRow: null
mouseWheelScreenRowClearDelay: 150
scrollViewMeasurementRequested: false
overflowChangedEventsPaused: false
overflowChangedWhilePaused: false
measureLineHeightAndDefaultCharWidthWhenShown: false
inputEnabled: true
@@ -176,7 +174,6 @@ EditorComponent = React.createClass
@updateParentViewFocusedClassIfNeeded(prevState)
@measureScrollbars() if @measuringScrollbars
@measureLineHeightAndCharWidthsIfNeeded(prevState)
@pauseOverflowChangedEvents()
@props.parentView.trigger 'editor:display-updated'
requestUpdate: ->
@@ -445,10 +442,7 @@ EditorComponent = React.createClass
@pendingHorizontalScrollDelta = 0
onScrollViewOverflowChanged: ->
if @overflowChangedEventsPaused
@overflowChangedWhilePaused = true
else
@requestScrollViewMeasurement()
@requestScrollViewMeasurement()
onWindowResize: ->
@requestScrollViewMeasurement()
@@ -674,18 +668,6 @@ EditorComponent = React.createClass
# if the editor's content and dimensions require them to be visible.
@requestUpdate()
pauseOverflowChangedEvents: ->
@overflowChangedEventsPaused = true
@resumeOverflowChangedEventsAfterDelay ?= debounce(@resumeOverflowChangedEvents, 500)
@resumeOverflowChangedEventsAfterDelay()
resumeOverflowChangedEvents: ->
if @overflowChangedWhilePaused
@overflowChangedWhilePaused = false
@requestScrollViewMeasurement()
resumeOverflowChangedEventsAfterDelay: null
clearMouseWheelScreenRow: ->
if @mouseWheelScreenRow?
@mouseWheelScreenRow = null