mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Combine all updates that occur in an animation frame
This commit is contained in:
@@ -25,6 +25,8 @@ EditorComponent = React.createClass
|
||||
pendingScrollTop: null
|
||||
pendingScrollLeft: null
|
||||
selectOnMouseMove: false
|
||||
updatesPaused: false
|
||||
updateRequestedWhilePaused: false
|
||||
updateRequested: false
|
||||
cursorsMoved: false
|
||||
selectionChanged: false
|
||||
@@ -203,20 +205,23 @@ EditorComponent = React.createClass
|
||||
@remeasureCharacterWidthsIfNeeded(prevState)
|
||||
|
||||
requestUpdate: ->
|
||||
if @performSyncUpdates ? EditorComponent.performSyncUpdates
|
||||
@forceUpdate()
|
||||
else unless @updateRequested
|
||||
@updateRequested = true
|
||||
process.nextTick =>
|
||||
@updateRequested = false
|
||||
@forceUpdate() if @isMounted()
|
||||
if @updatesPaused
|
||||
@updateRequestedWhilePaused = true
|
||||
else
|
||||
if @performSyncUpdates ? EditorComponent.performSyncUpdates
|
||||
@forceUpdate()
|
||||
else unless @updateRequested
|
||||
@updateRequested = true
|
||||
process.nextTick =>
|
||||
@updateRequested = false
|
||||
@forceUpdate() if @isMounted()
|
||||
|
||||
requestAnimationFrame: (fn) ->
|
||||
prevPerformSyncUpdates = @performSyncUpdates
|
||||
@performSyncUpdates = true
|
||||
requestAnimationFrame =>
|
||||
@updatesPaused = true
|
||||
fn()
|
||||
@performSyncUpdates = prevPerformSyncUpdates
|
||||
@updatesPaused = false
|
||||
@forceUpdate() if @updateRequestedWhilePaused
|
||||
|
||||
getRenderedRowRange: ->
|
||||
{editor, lineOverdrawMargin} = @props
|
||||
|
||||
Reference in New Issue
Block a user