Ensure selections span the entire screen, even when lines are short

Also, pass scrollHeight and scrollWidth as props to child components
instead of calling the method to compute them in multiple components.
Esse commit está contido em:
Nathan Sobo
2014-04-21 12:54:59 -06:00
commit c730e3c67e
4 arquivos alterados com 16 adições e 10 exclusões
+8 -5
Ver Arquivo
@@ -36,13 +36,16 @@ EditorComponent = React.createClass
className += ' is-focused' if focused
div className: className, style: {fontSize, lineHeight, fontFamily}, tabIndex: -1, onFocus: @onFocus,
GutterComponent({editor, renderedRowRange, scrollTop, lineHeight: lineHeightInPixels, @pendingChanges})
GutterComponent {
editor, renderedRowRange, scrollTop, scrollHeight,
lineHeight: lineHeightInPixels, @pendingChanges
}
EditorScrollViewComponent {
ref: 'scrollView', editor, renderedRowRange, @pendingChanges,
@scrollingVertically, showIndentGuide, fontSize, fontFamily,
lineHeight: lineHeightInPixels, @cursorsMoved, cursorBlinkPeriod,
cursorBlinkResumeDelay, @onInputFocused, @onInputBlurred,
ref: 'scrollView', editor, fontSize, fontFamily, showIndentGuide
scrollHeight, scrollWidth, lineHeight: lineHeightInPixels,
renderedRowRange, @pendingChanges, @scrollingVertically, @cursorsMoved,
cursorBlinkPeriod, cursorBlinkResumeDelay, @onInputFocused, @onInputBlurred
}
ScrollbarComponent
+5 -3
Ver Arquivo
@@ -16,12 +16,14 @@ EditorScrollViewComponent = React.createClass
overflowChangedWhilePaused: false
render: ->
{editor, fontSize, fontFamily, lineHeight, showIndentGuide, cursorBlinkPeriod, cursorBlinkResumeDelay} = @props
{renderedRowRange, pendingChanges, scrollingVertically, cursorsMoved, onInputFocused, onInputBlurred} = @props
{editor, fontSize, fontFamily, lineHeight, showIndentGuide} = @props
{scrollHeight, scrollWidth, renderedRowRange, pendingChanges, scrollingVertically} = @props
{cursorBlinkPeriod, cursorBlinkResumeDelay, cursorsMoved, onInputFocused, onInputBlurred} = @props
if @isMounted()
contentStyle =
height: editor.getScrollHeight()
height: scrollHeight
minWidth: scrollWidth
WebkitTransform: "translate3d(#{-editor.getScrollLeft()}px, #{-editor.getScrollTop()}px, 0)"
div className: 'scroll-view',
+2 -2
Ver Arquivo
@@ -13,14 +13,14 @@ GutterComponent = React.createClass
@renderLineNumbers() if @isMounted()
renderLineNumbers: ->
{editor, renderedRowRange, scrollTop} = @props
{editor, renderedRowRange, scrollTop, scrollHeight} = @props
[startRow, endRow] = renderedRowRange
charWidth = editor.getDefaultCharWidth()
lineHeight = editor.getLineHeight()
maxDigits = editor.getLastBufferRow().toString().length
style =
width: charWidth * (maxDigits + 1.5)
height: editor.getScrollHeight()
height: scrollHeight
WebkitTransform: "translate3d(0, #{-scrollTop}px, 0)"
lineNumbers = []
+1
Ver Arquivo
@@ -38,6 +38,7 @@
.scroll-view-content {
position: relative;
width: 100%;
}
.gutter {