fix editor automatically scrolling up at small zoom

This commit is contained in:
nightwing 2012-12-08 22:19:37 +04:00
commit b0bbb36923

View file

@ -85,7 +85,11 @@ var ScrollBar = function(parent) {
* *
**/ **/
this.onScroll = function() { 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. // this.element.scrollTop != scrollTop which makes page to scroll up.
/** /**
* Sets the scroll top of the scroll bar. * Sets the scroll top of the scroll bar.
@ -130,7 +134,10 @@ var ScrollBar = function(parent) {
* *
**/ **/
this.setScrollTop = function(scrollTop) { this.setScrollTop = function(scrollTop) {
this.element.scrollTop = scrollTop; if (this.scrollTop != scrollTop) {
this.skipEvent = true;
this.scrollTop = this.element.scrollTop = scrollTop;
}
}; };
}).call(ScrollBar.prototype); }).call(ScrollBar.prototype);