This commit is contained in:
Nathan Sobo
2014-06-03 18:19:11 +09:00
parent be0877327e
commit 9511c952af
2 changed files with 14 additions and 4 deletions

View File

@@ -575,15 +575,18 @@ EditorComponent = React.createClass
measureLineHeightAndCharWidthsIfNeeded: (prevState) ->
if not isEqualForProperties(prevState, @state, 'lineHeight', 'fontSize', 'fontFamily')
@props.editor.batchUpdates =>
{editor} = @props
editor.batchUpdates =>
oldDefaultCharWidth = editor.getDefaultCharWidth()
if @state.visible
@measureLineHeightAndDefaultCharWidth()
else
@measureLineHeightAndDefaultCharWidthWhenShown = true
unless isEqualForProperties(prevState, @state, 'fontSize', 'fontFamily')
@refs.lines.clearScopedCharWidths()
@refs.lines.measureCharactersInNewLines()
unless oldDefaultCharWidth is editor.getDefaultCharWidth()
@remeasureCharacterWidths()
else if @measureLineHeightAndDefaultCharWidthWhenShown and @state.visible and not prevState.visible
@measureLineHeightAndDefaultCharWidth()
@@ -592,6 +595,9 @@ EditorComponent = React.createClass
@measureLineHeightAndDefaultCharWidthWhenShown = false
@refs.lines.measureLineHeightAndDefaultCharWidth()
remeasureCharacterWidths: ->
@refs.lines.remeasureCharacterWidths()
measureScrollbars: ->
@measuringScrollbars = false

View File

@@ -209,6 +209,10 @@ LinesComponent = React.createClass
editor.setLineHeightInPixels(lineHeightInPixels)
editor.setDefaultCharWidth(charWidth)
remeasureCharacterWidths: ->
@clearScopedCharWidths()
@measureCharactersInNewLines()
measureCharactersInNewLines: ->
[visibleStartRow, visibleEndRow] = @props.renderedRowRange
node = @getDOMNode()