mirror of
https://github.com/atom/atom.git
synced 2026-01-25 06:48:28 -05:00
Preserve un-rounded scroll positions
This commit is contained in:
@@ -809,10 +809,10 @@ class TextEditorComponent
|
||||
{clientX, clientY} = event
|
||||
|
||||
linesClientRect ?= @linesComponent.getDomNode().getBoundingClientRect()
|
||||
top = clientY - linesClientRect.top + @presenter.scrollTop
|
||||
left = clientX - linesClientRect.left + @presenter.scrollLeft
|
||||
bottom = linesClientRect.top + @presenter.scrollTop + linesClientRect.height - clientY
|
||||
right = linesClientRect.left + @presenter.scrollLeft + linesClientRect.width - clientX
|
||||
top = clientY - linesClientRect.top + @presenter.getRealScrollTop()
|
||||
left = clientX - linesClientRect.left + @presenter.getRealScrollLeft()
|
||||
bottom = linesClientRect.top + @presenter.getRealScrollTop() + linesClientRect.height - clientY
|
||||
right = linesClientRect.left + @presenter.getRealScrollLeft() + linesClientRect.width - clientX
|
||||
|
||||
{top, left, bottom, right}
|
||||
|
||||
|
||||
@@ -830,6 +830,9 @@ class TextEditorPresenter
|
||||
getScrollTop: ->
|
||||
@scrollTop
|
||||
|
||||
getRealScrollTop: ->
|
||||
@realScrollTop ? @scrollTop
|
||||
|
||||
didStartScrolling: ->
|
||||
if @stoppedScrollingTimeoutId?
|
||||
clearTimeout(@stoppedScrollingTimeoutId)
|
||||
@@ -865,6 +868,9 @@ class TextEditorPresenter
|
||||
getScrollLeft: ->
|
||||
@scrollLeft
|
||||
|
||||
getRealScrollLeft: ->
|
||||
@realScrollLeft ? @scrollLeft
|
||||
|
||||
getClientHeight: ->
|
||||
if @clientHeight
|
||||
@clientHeight
|
||||
@@ -1542,15 +1548,17 @@ class TextEditorPresenter
|
||||
@setScrollRight(desiredScrollRight)
|
||||
|
||||
commitPendingScrollLeftPosition: ->
|
||||
scrollLeft = Math.round(@constrainScrollLeft(@pendingScrollLeft))
|
||||
scrollLeft = @constrainScrollLeft(@pendingScrollLeft)
|
||||
if scrollLeft isnt @scrollLeft and not Number.isNaN(scrollLeft)
|
||||
@scrollLeft = scrollLeft
|
||||
@realScrollLeft = scrollLeft
|
||||
@scrollLeft = Math.round(scrollLeft)
|
||||
@model.setScrollLeft(@scrollLeft)
|
||||
|
||||
commitPendingScrollTopPosition: ->
|
||||
scrollTop = Math.round(@constrainScrollTop(@pendingScrollTop))
|
||||
scrollTop = @constrainScrollTop(@pendingScrollTop)
|
||||
if scrollTop isnt @scrollTop and not Number.isNaN(scrollTop)
|
||||
@scrollTop = scrollTop
|
||||
@realScrollTop = scrollTop
|
||||
@scrollTop = Math.round(scrollTop)
|
||||
@model.setScrollTop(@scrollTop)
|
||||
|
||||
updateScrollPosition: ->
|
||||
|
||||
Reference in New Issue
Block a user