add getScrollHeight. fixes #16.
This commit is contained in:
parent
b280a3c320
commit
38f234aa91
|
@ -477,12 +477,17 @@ A box with scrollable content.
|
|||
|
||||
- inherits all from Box.
|
||||
- **scroll** - received when the element is scrolled.
|
||||
- **resetScroll** - reset scroll offset to zero.
|
||||
|
||||
##### Methods:
|
||||
|
||||
- **scroll(offset)** - scroll the content by an offset.
|
||||
- **scroll(offset)** - scroll the content by a relative offset.
|
||||
- **scrollTo(index)** - scroll the content to an absolute index.
|
||||
- **setScroll(index)** - same as `scrollTo`.
|
||||
- **setScrollPerc(perc)** - set the current scroll index in percentage (0-100).
|
||||
- **getScroll()** - get the current scroll index in lines.
|
||||
- **getScrollHeight()** - get the actual height of the scrolling area.
|
||||
- **getScrollPerc()** - get the current scroll index in percentage.
|
||||
- **resetScroll()** - reset the scroll index to its initial state.
|
||||
|
||||
|
||||
#### ScrollableText (from ScrollableBox)
|
||||
|
|
|
@ -3856,12 +3856,16 @@ ScrollableBox.prototype.resetScroll = function() {
|
|||
return this.emit('scroll');
|
||||
};
|
||||
|
||||
ScrollableBox.prototype.getScrollHeight = function(s) {
|
||||
return Math.max(this._clines.length, this._scrollBottom());
|
||||
};
|
||||
|
||||
ScrollableBox.prototype.getScrollPerc = function(s) {
|
||||
var pos = this.lpos || this._getCoords();
|
||||
if (!pos) return s ? -1 : 0;
|
||||
|
||||
var height = (pos.yl - pos.yi) - this.iheight
|
||||
, i = Math.max(this._clines.length, this._scrollBottom())
|
||||
, i = this.getScrollHeight()
|
||||
, p;
|
||||
|
||||
if (height < i) {
|
||||
|
|
Loading…
Reference in New Issue