mirror of
https://github.com/atom/atom.git
synced 2026-02-12 23:55:10 -05:00
Improve LinesYardstick design
We have shifted the responsibility of orchestrating state updates and measurements to the yardstick. The presenter still needs to be updated to make use of these new capabilities.
This commit is contained in:
@@ -4,14 +4,18 @@ AcceptFilter = {acceptNode: -> NodeFilter.FILTER_ACCEPT}
|
||||
|
||||
module.exports =
|
||||
class LinesYardstick
|
||||
constructor: (@model, @lineNodesProvider) ->
|
||||
constructor: (@model, @presenter, @lineNodesProvider) ->
|
||||
@cachedPositionsByLineId = {}
|
||||
@tokenIterator = new TokenIterator
|
||||
@rangeForMeasurement = document.createRange()
|
||||
@cachedPositionsByLineId = {}
|
||||
|
||||
clearCache: ->
|
||||
@cachedPositionsByLineId = {}
|
||||
|
||||
prepareScreenRowsForMeasurement: (screenRows) ->
|
||||
state = @presenter.getStateForMeasurements(screenRows)
|
||||
@lineNodesProvider.updateSync(state)
|
||||
|
||||
pixelPositionForScreenPosition: (screenPosition, clip=true) ->
|
||||
screenPosition = Point.fromObject(screenPosition)
|
||||
screenPosition = @model.clipScreenPosition(screenPosition) if clip
|
||||
|
||||
Reference in New Issue
Block a user