diff --git a/lib/ace/scrollbar.js b/lib/ace/scrollbar.js index b667881c..36619bd5 100644 --- a/lib/ace/scrollbar.js +++ b/lib/ace/scrollbar.js @@ -85,7 +85,11 @@ var ScrollBar = function(parent) { * **/ this.onScroll = function() { - this._emit("scroll", {data: this.element.scrollTop}); + if (!this.skipEvent) { + this.scrollTop = this.element.scrollTop; + this._emit("scroll", {data: this.scrollTop}); + } + this.skipEvent = false; }; /** @@ -120,7 +124,7 @@ var ScrollBar = function(parent) { }; - // TODO: on chrome 17+ for small zoom levels after calling this function + // on chrome 17+ for small zoom levels after calling this function // this.element.scrollTop != scrollTop which makes page to scroll up. /** * Sets the scroll top of the scroll bar. @@ -130,7 +134,10 @@ var ScrollBar = function(parent) { * **/ this.setScrollTop = function(scrollTop) { - this.element.scrollTop = scrollTop; + if (this.scrollTop != scrollTop) { + this.skipEvent = true; + this.scrollTop = this.element.scrollTop = scrollTop; + } }; }).call(ScrollBar.prototype);