resize scrollbar for scrollPastEnd only when needed

This commit is contained in:
nightwing 2013-07-07 12:50:24 +04:00
commit 8a6320bfd1

View file

@ -864,9 +864,14 @@ var VirtualRenderer = function(container, theme) {
this.scrollBarH.setVisible(horizScroll);
}
if (!this.$maxLines && this.$scrollPastEnd)
maxHeight += (this.$size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd;
if (!this.$maxLines && this.$scrollPastEnd) {
if (this.scrollTop > maxHeight - this.$size.scrollerHeight)
maxHeight += Math.min(
(this.$size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd,
this.scrollTop - maxHeight + this.$size.scrollerHeight
);
}
var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible ||
this.$size.scrollerHeight - maxHeight < 0);
var vScrollChanged = this.$vScroll !== vScroll;
@ -1271,7 +1276,8 @@ var VirtualRenderer = function(container, theme) {
if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top)
return true;
if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight
- this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom)
- this.layerConfig.maxHeight - (this.$size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd
< -1 + this.scrollMargin.bottom)
return true;
// todo: better handle horizontal scrolling
if (deltaX)