Only store backgroundColor and gutterBackgroundColor on presenter

This commit is contained in:
Nathan Sobo
2015-01-27 17:39:21 -07:00
parent fd50a0db6c
commit 1a22952eda
2 changed files with 11 additions and 14 deletions

View File

@@ -23,8 +23,6 @@ TextEditorComponent = React.createClass
visible: false
autoHeight: false
backgroundColor: null
gutterBackgroundColor: null
pendingScrollTop: null
pendingScrollLeft: null
selectOnMouseMove: false
@@ -98,7 +96,7 @@ TextEditorComponent = React.createClass
LinesComponent {
ref: 'lines', @presenter, editor, hostElement, @useHardwareAcceleration, useShadowDOM,
mouseWheelScreenRow, visible, @backgroundColor
mouseWheelScreenRow, visible
}
ScrollbarComponent
@@ -773,16 +771,11 @@ TextEditorComponent = React.createClass
{hostElement} = @props
{backgroundColor} = getComputedStyle(hostElement)
if backgroundColor isnt @backgroundColor
@backgroundColor = backgroundColor
@presenter.setBackgroundColor(backgroundColor)
@presenter.setBackgroundColor(backgroundColor)
if @refs.gutter?
gutterBackgroundColor = getComputedStyle(@refs.gutter.getDOMNode()).backgroundColor
if gutterBackgroundColor isnt @gutterBackgroundColor
@gutterBackgroundColor = gutterBackgroundColor
@presenter.setGutterBackgroundColor(gutterBackgroundColor)
@requestUpdate() unless suppressUpdate
@presenter.setGutterBackgroundColor(gutterBackgroundColor)
measureLineHeightAndDefaultCharWidth: ->
if @isVisible()

View File

@@ -389,13 +389,17 @@ class TextEditorPresenter
getClientWidth: -> @clientWidth
setBackgroundColor: (@backgroundColor) ->
@updateContentState()
setBackgroundColor: (backgroundColor) ->
if backgroundColor isnt @backgroundColor
@backgroundColor = backgroundColor
@updateContentState()
getBackgroundColor: -> @backgroundColor
setGutterBackgroundColor: (@gutterBackgroundColor) ->
@updateGutterState()
setGutterBackgroundColor: (gutterBackgroundColor) ->
if gutterBackgroundColor isnt @gutterBackgroundColor
@gutterBackgroundColor = gutterBackgroundColor
@updateGutterState()
getGutterBackgroundColor: -> @gutterBackgroundColor