Add autoscrolling with react editor view

Its implemented in the model to restrict touching of the DOM.
This commit is contained in:
Nathan Sobo
2014-04-02 18:32:19 -06:00
parent ba83b0ede0
commit e472d7b038
4 changed files with 61 additions and 4 deletions

View File

@@ -144,15 +144,16 @@ class Editor extends Model
cursors: null
selections: null
suppressSelectionMerging: false
verticalScrollMargin: 2
@delegatesMethods 'suggestedIndentForBufferRow', 'autoIndentBufferRow', 'autoIndentBufferRows',
'autoDecreaseIndentForBufferRow', 'toggleLineCommentForBufferRow', 'toggleLineCommentsForBufferRows',
toProperty: 'languageMode'
@delegatesMethods 'setLineHeight', 'getLineHeight', 'setDefaultCharWidth', 'setHeight',
'getHeight', 'setWidth', 'getWidth', 'setScrollTop', 'getScrollTop', 'setScrollLeft',
'getScrollLeft', 'getScrollHeight', 'getVisibleRowRange', 'intersectsVisibleRowRange',
'selectionIntersectsVisibleRowRange', toProperty: 'displayBuffer'
'getHeight', 'setWidth', 'getWidth', 'setScrollTop', 'getScrollTop', 'getScrollBottom',
'setScrollBottom', 'setScrollLeft', 'getScrollLeft', 'getScrollHeight', 'getVisibleRowRange',
'intersectsVisibleRowRange', 'selectionIntersectsVisibleRowRange', toProperty: 'displayBuffer'
@delegatesProperties '$lineHeight', '$defaultCharWidth', '$height', '$width',
'$scrollTop', '$scrollLeft', toProperty: 'displayBuffer'
@@ -308,6 +309,10 @@ class Editor extends Model
# Public: Toggle soft wrap for this editor
toggleSoftWrap: -> @setSoftWrap(not @getSoftWrap())
getVerticalScrollMargin: -> @verticalScrollMargin
setVerticalScrollMargin: (@verticalScrollMargin) -> @verticalScrollMargin
# Public: Get the text representing a single level of indent.
#
# If soft tabs are enabled, the text is composed of N spaces, where N is the