mirror of
https://github.com/atom/atom.git
synced 2026-02-15 09:05:58 -05:00
Relativize pixelPositionForScreenPosition.top
This commit makes the method return a `top` value which is relative to the viewport. However, we still need to return an absolute value for `left` because lines are moved horizontally through a single transform on their parent node. I would prefer being consistent (i.e. make everything relative), but moving every single tile to simulate scrolling, on the other hand, seems overkill and it's not really intuitive given that we are not tiling horizontally. /cc: @nathansobo
This commit is contained in:
@@ -375,11 +375,11 @@ class TextEditorPresenter
|
||||
else
|
||||
screenPosition = decoration.getMarker().getHeadScreenPosition()
|
||||
|
||||
pixelPosition = @pixelPositionForScreenPosition(screenPosition, true, absolute: true)
|
||||
pixelPosition = @pixelPositionForScreenPosition(screenPosition, true)
|
||||
|
||||
{scrollTop, scrollLeft} = @state.content
|
||||
{scrollLeft} = @state.content
|
||||
|
||||
top = pixelPosition.top + @lineHeight - scrollTop
|
||||
top = pixelPosition.top + @lineHeight
|
||||
left = pixelPosition.left + @gutterWidth - scrollLeft
|
||||
|
||||
if overlayDimensions = @overlayDimensions[decoration.id]
|
||||
@@ -963,7 +963,7 @@ class TextEditorPresenter
|
||||
hasPixelPositionRequirements: ->
|
||||
@lineHeight? and @baseCharacterWidth?
|
||||
|
||||
pixelPositionForScreenPosition: (screenPosition, clip=true, {absolute}={}) ->
|
||||
pixelPositionForScreenPosition: (screenPosition, clip=true) ->
|
||||
screenPosition = Point.fromObject(screenPosition)
|
||||
screenPosition = @model.clipScreenPosition(screenPosition) if clip
|
||||
|
||||
@@ -993,7 +993,7 @@ class TextEditorPresenter
|
||||
left += characterWidths[char] ? baseCharacterWidth unless char is '\0'
|
||||
column += charLength
|
||||
|
||||
top -= @scrollTop unless absolute
|
||||
top -= @scrollTop
|
||||
{top, left}
|
||||
|
||||
hasPixelRectRequirements: ->
|
||||
|
||||
Reference in New Issue
Block a user