From a6dab4860c7ced496f9fd4c5ffc6e3c448c5f8ff Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 11 May 2015 10:01:02 +0200 Subject: [PATCH] Position overlays absolutely We did so by introducing an `absolute` (optional) parameter in `pixelPositionForScreenPosition`. --- src/text-editor-presenter.coffee | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index 0111c7a8a..e9944afce 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -375,7 +375,7 @@ class TextEditorPresenter else screenPosition = decoration.getMarker().getHeadScreenPosition() - pixelPosition = @pixelPositionForScreenPosition(screenPosition) + pixelPosition = @pixelPositionForScreenPosition(screenPosition, true, absolute: true) {scrollTop, scrollLeft} = @state.content @@ -963,7 +963,7 @@ class TextEditorPresenter hasPixelPositionRequirements: -> @lineHeight? and @baseCharacterWidth? - pixelPositionForScreenPosition: (screenPosition, clip=true) -> + pixelPositionForScreenPosition: (screenPosition, clip=true, {absolute}={}) -> screenPosition = Point.fromObject(screenPosition) screenPosition = @model.clipScreenPosition(screenPosition) if clip @@ -993,7 +993,8 @@ class TextEditorPresenter left += characterWidths[char] ? baseCharacterWidth unless char is '\0' column += charLength - {top: top - @scrollTop, left} + top -= @scrollTop unless absolute + {top, left} hasPixelRectRequirements: -> @hasPixelPositionRequirements() and @scrollWidth?