mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Add TextEditorElement::getMaxScrollTop
This commit is contained in:
@@ -421,6 +421,9 @@ class TextEditorComponent
|
||||
getScrollWidth: ->
|
||||
@presenter.getScrollWidth()
|
||||
|
||||
getMaxScrollTop: ->
|
||||
@presenter.getMaxScrollTop()
|
||||
|
||||
getVerticalScrollbarWidth: ->
|
||||
@presenter.getVerticalScrollbarWidth()
|
||||
|
||||
|
||||
@@ -210,6 +210,12 @@ class TextEditorElement extends HTMLElement
|
||||
getDefaultCharacterWidth: ->
|
||||
@getModel().getDefaultCharWidth()
|
||||
|
||||
# Extended: Get the maximum scroll top that can be applied to this element.
|
||||
#
|
||||
# Returns a {Number} of pixels.
|
||||
getMaxScrollTop: ->
|
||||
@component?.getMaxScrollTop()
|
||||
|
||||
# Extended: Converts a buffer position to a pixel position.
|
||||
#
|
||||
# * `bufferPosition` An object that represents a buffer position. It can be either
|
||||
|
||||
@@ -982,6 +982,13 @@ class TextEditorPresenter
|
||||
getScrollWidth: ->
|
||||
@scrollWidth
|
||||
|
||||
getMaxScrollTop: ->
|
||||
scrollHeight = @getScrollHeight()
|
||||
clientHeight = @getClientHeight()
|
||||
return 0 unless scrollHeight? and clientHeight?
|
||||
|
||||
scrollHeight - clientHeight
|
||||
|
||||
setHorizontalScrollbarHeight: (horizontalScrollbarHeight) ->
|
||||
unless @measuredHorizontalScrollbarHeight is horizontalScrollbarHeight
|
||||
oldHorizontalScrollbarHeight = @measuredHorizontalScrollbarHeight
|
||||
|
||||
Reference in New Issue
Block a user