Add ::state.content.scrollTop/Left to TextEditorPresenter

This commit is contained in:
Nathan Sobo
2015-01-21 17:01:23 -07:00
parent 78d87d8f7c
commit f479e9d029
2 changed files with 23 additions and 1 deletions

View File

@@ -3,7 +3,7 @@
module.exports =
class TextEditorPresenter
constructor: ({@model, @clientHeight, @clientWidth, @scrollTop, @lineHeight, @baseCharacterWidth, @lineOverdrawMargin}) ->
constructor: ({@model, @clientHeight, @clientWidth, @scrollTop, @scrollLeft, @lineHeight, @baseCharacterWidth, @lineOverdrawMargin}) ->
@disposables = new CompositeDisposable
@charWidthsByScope = {}
@observeModel()
@@ -44,6 +44,8 @@ class TextEditorPresenter
updateContentState: ->
@state.content.scrollWidth = @computeScrollWidth()
@state.content.scrollHeight = @computeScrollHeight()
@state.content.scrollTop = @getScrollTop()
@state.content.scrollLeft = @getScrollLeft()
@state.content.indentGuidesVisible = atom.config.get('editor.showIndentGuide', scope: @model.getRootScopeDescriptor())
updateLinesState: ->
@@ -122,10 +124,16 @@ class TextEditorPresenter
decorationClasses
setScrollTop: (@scrollTop) ->
@updateContentState()
@updateLinesState()
getScrollTop: -> @scrollTop
setScrollLeft: (@scrollLeft) ->
@updateContentState()
getScrollLeft: -> @scrollLeft
setClientHeight: (@clientHeight) ->
@updateLinesState()