mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2025-01-05 05:34:30 +03:00
Wait for next animation frame before measuring when stylesheets change
Fixes #4479
This commit is contained in:
parent
2028045254
commit
b386b00bc0
@ -1908,7 +1908,8 @@ describe "TextEditorComponent", ->
|
||||
}
|
||||
""", context: 'atom-text-editor'
|
||||
|
||||
nextAnimationFrame()
|
||||
nextAnimationFrame() # handle stylesheet change event
|
||||
nextAnimationFrame() # perform requested update
|
||||
|
||||
scrollbarCornerNode = componentNode.querySelector('.scrollbar-corner')
|
||||
expect(verticalScrollbarNode.offsetWidth).toBe 8
|
||||
|
@ -664,8 +664,13 @@ TextEditorComponent = React.createClass
|
||||
onStylesheetsChanged: (styleElement) ->
|
||||
return unless @performedInitialMeasurement
|
||||
return unless atom.themes.isInitialLoadComplete()
|
||||
@refreshScrollbars() if not styleElement.sheet? or @containsScrollbarSelector(styleElement.sheet)
|
||||
@handleStylingChange()
|
||||
|
||||
# This delay prevents the styling from going haywire when stylesheets are
|
||||
# reloaded in dev mode. It seems like a workaround for a browser bug, but
|
||||
# not totally sure.
|
||||
requestAnimationFrame =>
|
||||
@refreshScrollbars() if not styleElement.sheet? or @containsScrollbarSelector(styleElement.sheet)
|
||||
@handleStylingChange()
|
||||
|
||||
onAllThemesLoaded: ->
|
||||
@refreshScrollbars()
|
||||
|
Loading…
Reference in New Issue
Block a user