Construct LinesComponent with visibility param to avoid redundant update

This commit is contained in:
Nathan Sobo
2015-02-11 16:14:41 -07:00
parent 0047e3bc2d
commit ea49fc6d5f
2 changed files with 3 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ module.exports =
class LinesComponent
placeholderTextDiv: null
constructor: ({@presenter, @hostElement, @useShadowDOM}) ->
constructor: ({@presenter, @hostElement, @useShadowDOM, visible}) ->
@measuredLines = new Set
@lineNodesByLineId = {}
@screenRowsByLineId = {}
@@ -42,7 +42,7 @@ class LinesComponent
else
@overlayManager = new OverlayManager(@domNode)
@updateSync()
@updateSync(visible)
updateSync: (visible) ->
@newState = @presenter.state.content

View File

@@ -116,11 +116,10 @@ TextEditorComponent = React.createClass
@mountGutterComponent() if @gutterVisible
@linesComponent = new LinesComponent({@presenter, hostElement, useShadowDOM})
scrollViewNode = @refs.scrollView.getDOMNode()
horizontalScrollbarNode = @refs.horizontalScrollbar.getDOMNode()
@linesComponent = new LinesComponent({@presenter, hostElement, useShadowDOM, visible: @isVisible()})
scrollViewNode.insertBefore(@linesComponent.domNode, horizontalScrollbarNode)
@linesComponent.updateSync(@isVisible())
@observeEditor()
@listenForDOMEvents()