mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Rename filterDecorationsByMarkerId to getHighlightDecorations
And rename local variable to highlightDecorations to clarify intent
This commit is contained in:
@@ -52,8 +52,8 @@ EditorComponent = React.createClass
|
||||
cursorScreenRanges = @getCursorScreenRanges(renderedRowRange)
|
||||
|
||||
decorations = editor.decorationsForScreenRowRange(renderedStartRow, renderedEndRow)
|
||||
decorationsByMarkerId = @filterDecorationsByMarkerId(decorations)
|
||||
decorationsByScreenRow = @filterDecorationsByScreenRow(decorations)
|
||||
highlightDecorations = @getHighlightDecorations(decorations)
|
||||
|
||||
scrollHeight = editor.getScrollHeight()
|
||||
scrollWidth = editor.getScrollWidth()
|
||||
@@ -97,7 +97,7 @@ EditorComponent = React.createClass
|
||||
}
|
||||
LinesComponent {
|
||||
ref: 'lines',
|
||||
editor, lineHeightInPixels, defaultCharWidth, decorationsByScreenRow, decorationsByMarkerId,
|
||||
editor, lineHeightInPixels, defaultCharWidth, decorationsByScreenRow, highlightDecorations,
|
||||
showIndentGuide, renderedRowRange, @pendingChanges, scrollTop, scrollLeft,
|
||||
@scrollingVertically, scrollHeight, scrollWidth, mouseWheelScreenRow, invisibles,
|
||||
visible, scrollViewHeight
|
||||
@@ -232,7 +232,7 @@ EditorComponent = React.createClass
|
||||
decorationsByScreenRow[screenRow].push decoration.toObject()
|
||||
decorationsByScreenRow
|
||||
|
||||
filterDecorationsByMarkerId: (decorationsByMarkerId) ->
|
||||
getHighlightDecorations: (decorationsByMarkerId) ->
|
||||
filteredDecorations = {}
|
||||
for id, decorations of decorationsByMarkerId
|
||||
for decoration in decorations
|
||||
|
||||
@@ -11,14 +11,14 @@ HighlightsComponent = React.createClass
|
||||
div className: 'highlights', @renderHighlights()
|
||||
|
||||
renderHighlights: ->
|
||||
{editor, decorationsByMarkerId, lineHeightInPixels} = @props
|
||||
{editor, highlightDecorations, lineHeightInPixels} = @props
|
||||
|
||||
highlightComponents = []
|
||||
for markerId, decorations of decorationsByMarkerId
|
||||
for markerId, decorations of highlightDecorations
|
||||
if decorations?
|
||||
for decoration in decorations
|
||||
highlightComponents.push(HighlightComponent({key: "#{markerId}-#{decoration.class}", decoration, editor, lineHeightInPixels}))
|
||||
highlightComponents
|
||||
|
||||
shouldComponentUpdate: (newProps) ->
|
||||
not isEqualForProperties(newProps, @props, 'decorationsByMarkerId', 'lineHeightInPixels', 'defaultCharWidth')
|
||||
not isEqualForProperties(newProps, @props, 'highlightDecorations', 'lineHeightInPixels', 'defaultCharWidth')
|
||||
|
||||
@@ -15,14 +15,14 @@ LinesComponent = React.createClass
|
||||
|
||||
render: ->
|
||||
if @isMounted()
|
||||
{editor, decorationsByMarkerId, scrollTop, scrollLeft, scrollHeight, scrollWidth, lineHeightInPixels, defaultCharWidth, scrollViewHeight} = @props
|
||||
{editor, highlightDecorations, scrollTop, scrollLeft, scrollHeight, scrollWidth, lineHeightInPixels, defaultCharWidth, scrollViewHeight} = @props
|
||||
style =
|
||||
height: Math.max(scrollHeight, scrollViewHeight)
|
||||
width: scrollWidth
|
||||
WebkitTransform: "translate3d(#{-scrollLeft}px, #{-scrollTop}px, 0px)"
|
||||
|
||||
div {className: 'lines editor-colors', style},
|
||||
HighlightsComponent({editor, decorationsByMarkerId, lineHeightInPixels, defaultCharWidth}) if @isMounted()
|
||||
HighlightsComponent({editor, highlightDecorations, lineHeightInPixels, defaultCharWidth}) if @isMounted()
|
||||
|
||||
componentWillMount: ->
|
||||
@measuredLines = new WeakSet
|
||||
@@ -32,7 +32,7 @@ LinesComponent = React.createClass
|
||||
|
||||
shouldComponentUpdate: (newProps) ->
|
||||
return true unless isEqualForProperties(newProps, @props,
|
||||
'renderedRowRange', 'decorationsByMarkerId', 'lineHeightInPixels', 'defaultCharWidth',
|
||||
'renderedRowRange', 'highlightDecorations', 'lineHeightInPixels', 'defaultCharWidth',
|
||||
'scrollTop', 'scrollLeft', 'showIndentGuide', 'scrollingVertically', 'invisibles', 'visible',
|
||||
'scrollViewHeight', 'mouseWheelScreenRow'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user