Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
nightwing
902006e110 do not allow editor to scroll up automatically 2013-11-24 14:35:38 +04:00

View file

@ -64,8 +64,6 @@ var ScrollBarV = function(parent, renderer) {
// make element a little bit wider to retain scrollbar when page is zoomed // make element a little bit wider to retain scrollbar when page is zoomed
renderer.$scrollbarWidth = renderer.$scrollbarWidth =
this.width = dom.scrollbarWidth(parent.ownerDocument); this.width = dom.scrollbarWidth(parent.ownerDocument);
renderer.$scrollbarWidth =
this.width = dom.scrollbarWidth(parent.ownerDocument);
this.fullWidth = this.width; this.fullWidth = this.width;
this.inner.style.width = this.inner.style.width =
this.element.style.width = (this.width || 15) + 5 + "px"; this.element.style.width = (this.width || 15) + 5 + "px";
@ -85,12 +83,7 @@ var ScrollBarH = function(parent, renderer) {
this.element.appendChild(this.inner); this.element.appendChild(this.inner);
parent.appendChild(this.element); parent.appendChild(this.element);
// in OSX lion the scrollbars appear to have no width. In this case resize the
// element to show the scrollbar but still pretend that the scrollbar has a width
// of 0px
// in Firefox 6+ scrollbar is hidden if element has the same width as scrollbar
// make element a little bit wider to retain scrollbar when page is zoomed
this.height = renderer.$scrollbarWidth; this.height = renderer.$scrollbarWidth;
this.fullHeight = this.height; this.fullHeight = this.height;
this.inner.style.height = this.inner.style.height =
@ -181,17 +174,18 @@ var ScrollBarH = function(parent, renderer) {
// 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.
this.setScrollTop = function(scrollTop) { this.setScrollTop = function(scrollTop) {
if (this.scrollTop != scrollTop) { if (Math.abs(this.scrollTop - scrollTop) > 1) {
this.skipEvent = true; this.skipEvent = true;
this.scrollTop = this.element.scrollTop = scrollTop; this.scrollTop = this.element.scrollTop = Math.round(scrollTop);
} }
}; };
this.setScrollLeft = function(scrollLeft) { this.setScrollLeft = function(scrollLeft) {
if (this.scrollLeft != scrollLeft) { if (Math.abs(this.scrollLeft - scrollLeft) > 1) {
this.skipEvent = true; this.skipEvent = true;
this.scrollLeft = this.element.scrollLeft = scrollLeft; this.scrollLeft = this.element.scrollLeft = Math.round(scrollLeft);
} }
}; };
this.scrollTop = this.scrollLeft = 0;
}).call(ScrollBarV.prototype); }).call(ScrollBarV.prototype);
ScrollBarH.prototype = ScrollBarV.prototype; ScrollBarH.prototype = ScrollBarV.prototype;