fix editor automatically scrolling up at small zoom
This commit is contained in:
parent
b6890497c8
commit
b0bbb36923
1 changed files with 10 additions and 3 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue