fix scroll to Y

This commit is contained in:
Fabian Jakobs 2010-11-03 16:12:03 +01:00
commit 4c865950ed

View file

@ -298,7 +298,7 @@ var VirtualRenderer = function(container, theme) {
};
this.$updateScrollBar = function() {
this.scrollBar.setInnerHeight(this.doc.getLength() * this.lineHeight + this.$padding * 2);
this.scrollBar.setInnerHeight(this.doc.getLength() * this.lineHeight + this.$padding);
this.scrollBar.setScrollTop(this.scrollTop);
};
@ -523,10 +523,11 @@ var VirtualRenderer = function(container, theme) {
this.scrollToY = function(scrollTop) {
var maxHeight = this.lines.length * this.lineHeight - this.$size.scrollerHeight + this.$padding;
var scrollTop = Math.max(0, Math.min(maxHeight, scrollTop));
if (scrollTop >= maxHeight - this.$padding)
scrollTop = maxHeight;
var scrollTop = Math.max(0, Math.min(maxHeight, scrollTop));
if (this.scrollTop !== scrollTop) {
this.scrollTop = scrollTop;
this.$loop.schedule(this.CHANGE_SCROLL);
@ -536,7 +537,7 @@ var VirtualRenderer = function(container, theme) {
this.scrollToX = function(scrollLeft) {
if (scrollLeft <= this.$padding)
scrollLeft = 0;
this.scroller.scrollLeft = scrollLeft;
};