Don’t return Decoration objects from model to view

Preparation for LayerDecorations, in which individual decoration objects
won’t exist for every marker.
This commit is contained in:
Nathan Sobo
2015-10-26 16:29:24 -06:00
parent d46091d7e5
commit 92ed7c8b15
4 changed files with 77 additions and 96 deletions

View File

@@ -774,6 +774,18 @@ class DisplayBuffer extends Model
decorationsByMarkerId[marker.id] = decorations
decorationsByMarkerId
decorationStateForScreenRowRange: (startScreenRow, endScreenRow) ->
decorationState = {}
for marker in @findMarkers(intersectsScreenRowRange: [startScreenRow, endScreenRow]) when marker.isValid()
if decorations = @decorationsByMarkerId[marker.id]
for decoration in decorations
decorationState[decoration.id] = {
properties: decoration.getProperties()
screenRange: marker.getScreenRange()
rangeIsReversed: marker.isReversed()
}
decorationState
decorateMarker: (marker, decorationParams) ->
marker = @getMarker(marker.id)
decoration = new Decoration(marker, this, decorationParams)