Merge pull request #11420 from wvanlint/visible_overlay

Fixed positioning for overlay
This commit is contained in:
Nathan Sobo
2016-04-19 15:47:21 -06:00
2 changed files with 8 additions and 6 deletions

View File

@@ -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

View File

@@ -15,7 +15,7 @@ atom-text-editor[mini] {
}
atom-overlay {
position: absolute;
position: fixed;
display: block;
z-index: 4;
}