From 4c865950ed626ae7ea3107e1f817eac90bac7e66 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Wed, 3 Nov 2010 16:12:03 +0100 Subject: [PATCH] fix scroll to Y --- lib/ace/VirtualRenderer.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ace/VirtualRenderer.js b/lib/ace/VirtualRenderer.js index dbf08e1e..21042538 100644 --- a/lib/ace/VirtualRenderer.js +++ b/lib/ace/VirtualRenderer.js @@ -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; };