mirror of
https://github.com/atom/atom.git
synced 2026-02-15 17:15:24 -05:00
Make each section of presenter state self-contained
This means we have some duplicated values in different parts of the tree, but it’s cleaner in the view since each component only consumes a single object. Seems like the presenter should convey the correct data to the correct locations and minimize the logic in the view. A few duplicated integers is a reasonable trade-off.
This commit is contained in:
@@ -34,7 +34,6 @@ TextEditorComponent = React.createClass
|
||||
scrollSensitivity: 0.4
|
||||
heightAndWidthMeasurementRequested: false
|
||||
inputEnabled: true
|
||||
scopedCharacterWidthsChangeCount: null
|
||||
domPollingInterval: 100
|
||||
domPollingIntervalId: null
|
||||
domPollingPaused: false
|
||||
@@ -56,7 +55,7 @@ TextEditorComponent = React.createClass
|
||||
hiddenInputStyle = @getHiddenInputPosition()
|
||||
hiddenInputStyle.WebkitTransform = 'translateZ(0)' if @useHardwareAcceleration
|
||||
|
||||
style.height = @presenter.state.scrollHeight if @autoHeight
|
||||
style.height = @presenter.state.content.scrollHeight if @autoHeight
|
||||
|
||||
if useShadowDOM
|
||||
className = 'editor-contents--private'
|
||||
@@ -233,7 +232,6 @@ TextEditorComponent = React.createClass
|
||||
@subscribe editor.observeGrammar(@onGrammarChanged)
|
||||
@subscribe editor.observeCursors(@onCursorAdded)
|
||||
@subscribe editor.observeSelections(@onSelectionAdded)
|
||||
@subscribe editor.onDidChangeCharacterWidths(@onCharacterWidthsChanged)
|
||||
@subscribe editor.$scrollTop.changes, @onScrollTopChanged
|
||||
@subscribe editor.$scrollLeft.changes, @onScrollLeftChanged
|
||||
@subscribe editor.$verticalScrollbarWidth.changes, @requestUpdate
|
||||
@@ -579,9 +577,6 @@ TextEditorComponent = React.createClass
|
||||
@cursorMoved = true
|
||||
@requestUpdate()
|
||||
|
||||
onCharacterWidthsChanged: (@scopedCharacterWidthsChangeCount) ->
|
||||
@requestUpdate()
|
||||
|
||||
handleDragUntilMouseUp: (event, dragHandler) ->
|
||||
{editor} = @props
|
||||
dragging = false
|
||||
|
||||
Reference in New Issue
Block a user