From 8cd48004dd68d5ea3e4d4f0fada256aa1b83186d Mon Sep 17 00:00:00 2001 From: Willem Van Lint Date: Sat, 9 Apr 2016 18:42:18 -0700 Subject: [PATCH] Fixed positioning for overlay --- src/text-editor-presenter.coffee | 12 +++++++----- static/text-editor-light.less | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index ef1b403c3..e5a9cd589 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -459,19 +459,21 @@ class TextEditorPresenter pixelPosition = @pixelPositionForScreenPosition(screenPosition) - top = pixelPosition.top + @lineHeight - left = pixelPosition.left + @gutterWidth + # Fixed positioning. + top = @boundingClientRect.top + pixelPosition.top + @lineHeight + left = @boundingClientRect.left + pixelPosition.left + @gutterWidth if overlayDimensions = @overlayDimensions[decoration.id] {itemWidth, itemHeight, contentMargin} = overlayDimensions - rightDiff = left + @boundingClientRect.left + itemWidth + contentMargin - @windowWidth + rightDiff = left + itemWidth + contentMargin - @windowWidth left -= rightDiff if rightDiff > 0 - leftDiff = left + @boundingClientRect.left + contentMargin + leftDiff = left + contentMargin left -= leftDiff if leftDiff < 0 - if top + @boundingClientRect.top + itemHeight > @windowHeight and top - (itemHeight + @lineHeight) >= 0 + if top + itemHeight > @windowHeight and + top - (itemHeight + @lineHeight) >= 0 top -= itemHeight + @lineHeight pixelPosition.top = top diff --git a/static/text-editor-light.less b/static/text-editor-light.less index 7fafade1e..f5429fd7f 100644 --- a/static/text-editor-light.less +++ b/static/text-editor-light.less @@ -15,7 +15,7 @@ atom-text-editor[mini] { } atom-overlay { - position: absolute; + position: fixed; display: block; z-index: 4; }