Don't measure lineHeight/defaultCharWidth when editor is hidden

This commit is contained in:
Kevin Sawicki & Nathan Sobo
2014-05-21 17:15:47 -06:00
parent 68c3113b75
commit ee9d4ab70e
5 changed files with 46 additions and 7 deletions

View File

@@ -35,7 +35,7 @@ LinesComponent = React.createClass
shouldComponentUpdate: (newProps) ->
return true if newProps.selectionChanged
return true unless isEqualForProperties(newProps, @props, 'renderedRowRange', 'fontSize', 'fontFamily', 'lineHeight', 'scrollTop', 'scrollLeft', 'showIndentGuide', 'scrollingVertically', 'invisibles')
return true unless isEqualForProperties(newProps, @props, 'renderedRowRange', 'fontSize', 'fontFamily', 'lineHeight', 'scrollTop', 'scrollLeft', 'showIndentGuide', 'scrollingVertically', 'invisibles', 'visible')
{renderedRowRange, pendingChanges} = newProps
for change in pendingChanges
@@ -44,7 +44,9 @@ LinesComponent = React.createClass
false
componentDidUpdate: (prevProps) ->
@measureLineHeightAndCharWidth() unless isEqualForProperties(prevProps, @props, 'fontSize', 'fontFamily', 'lineHeight')
{visible} = @props
if visible and not isEqualForProperties(prevProps, @props, 'fontSize', 'fontFamily', 'lineHeight', 'visible')
@measureLineHeightAndCharWidth()
@clearScreenRowCaches() unless prevProps.lineHeight is @props.lineHeight
@removeLineNodes() unless isEqualForProperties(prevProps, @props, 'showIndentGuide', 'invisibles')
@updateLines()