This commit is contained in:
Antonio Scandurra
2015-10-05 16:28:02 +02:00
parent 0bee6a0cc1
commit 1c56c3f951
3 changed files with 6 additions and 9 deletions

View File

@@ -31,7 +31,6 @@ describe "LinesYardstick", ->
lineNode
mockPresenter =
isBatching: -> true
setScreenRowsToMeasure: (screenRows) -> screenRowsToMeasure = screenRows
clearScreenRowsToMeasure: -> setScreenRowsToMeasure = []
getPreMeasurementState: ->

View File

@@ -12,8 +12,6 @@ class LinesYardstick
@pixelPositionsByLineIdAndColumn = {}
prepareScreenRowsForMeasurement: (screenRows) ->
return unless @presenter.isBatching()
@presenter.setScreenRowsToMeasure(screenRows)
@lineNodesProvider.updateSync(@presenter.getPreMeasurementState())
@@ -173,17 +171,17 @@ class LinesYardstick
left + width - offset
pixelRectForScreenRange: (screenRange) ->
pixelRectForScreenRange: (screenRange, measureVisibleLinesOnly) ->
lineHeight = @model.getLineHeightInPixels()
if screenRange.end.row > screenRange.start.row
top = @pixelPositionForScreenPosition(screenRange.start).top
top = @pixelPositionForScreenPosition(screenRange.start, true, measureVisibleLinesOnly).top
left = 0
height = (screenRange.end.row - screenRange.start.row + 1) * lineHeight
width = @presenter.getScrollWidth()
else
{top, left} = @pixelPositionForScreenPosition(screenRange.start, false)
{top, left} = @pixelPositionForScreenPosition(screenRange.start, false, measureVisibleLinesOnly)
height = lineHeight
width = @pixelPositionForScreenPosition(screenRange.end, false).left - left
width = @pixelPositionForScreenPosition(screenRange.end, false, measureVisibleLinesOnly).left - left
{top, left, width, height}

View File

@@ -1128,7 +1128,7 @@ class TextEditorPresenter
pixelPositionForScreenPosition: (screenPosition, clip=true) ->
position =
@linesYardstick.pixelPositionForScreenPosition(screenPosition, clip)
@linesYardstick.pixelPositionForScreenPosition(screenPosition, clip, true)
position.top -= @getScrollTop()
position.left -= @getScrollLeft()
@@ -1144,7 +1144,7 @@ class TextEditorPresenter
@hasPixelRectRequirements() and @boundingClientRect? and @windowWidth and @windowHeight
pixelRectForScreenRange: (screenRange) ->
rect = @linesYardstick.pixelRectForScreenRange(screenRange)
rect = @linesYardstick.pixelRectForScreenRange(screenRange, true)
rect.top -= @getScrollTop()
rect.left -= @getScrollLeft()