|
59 | 59 | CodeMirror.on(this.node, "DOMMouseScroll", onWheel); |
60 | 60 | } |
61 | 61 |
|
62 | | - Bar.prototype.moveTo = function(pos, update) { |
| 62 | + Bar.prototype.setPos = function(pos) { |
63 | 63 | if (pos < 0) pos = 0; |
64 | 64 | if (pos > this.total - this.screen) pos = this.total - this.screen; |
65 | | - if (pos == this.pos) return; |
| 65 | + if (pos == this.pos) return false; |
66 | 66 | this.pos = pos; |
67 | 67 | this.inner.style[this.orientation == "horizontal" ? "left" : "top"] = |
68 | 68 | (pos * (this.size / this.total)) + "px"; |
69 | | - if (update !== false) this.scroll(pos, this.orientation); |
| 69 | + return true |
70 | 70 | }; |
71 | 71 |
|
| 72 | + Bar.prototype.moveTo = function(pos) { |
| 73 | + if (this.setPos(pos)) this.scroll(pos, this.orientation); |
| 74 | + } |
| 75 | + |
72 | 76 | var minButtonSize = 10; |
73 | 77 |
|
74 | 78 | Bar.prototype.update = function(scrollSize, clientSize, barSize) { |
|
83 | 87 | } |
84 | 88 | this.inner.style[this.orientation == "horizontal" ? "width" : "height"] = |
85 | 89 | buttonSize + "px"; |
86 | | - this.inner.style[this.orientation == "horizontal" ? "left" : "top"] = |
87 | | - this.pos * (this.size / this.total) + "px"; |
| 90 | + this.setPos(this.pos); |
88 | 91 | }; |
89 | 92 |
|
90 | 93 | function SimpleScrollbars(cls, place, scroll) { |
|
111 | 114 | if (needsV) { |
112 | 115 | this.vert.update(measure.scrollHeight, measure.clientHeight, |
113 | 116 | measure.viewHeight - (needsH ? width : 0)); |
114 | | - this.vert.node.style.display = "block"; |
115 | 117 | this.vert.node.style.bottom = needsH ? width + "px" : "0"; |
116 | 118 | } |
117 | 119 | if (needsH) { |
|
125 | 127 | }; |
126 | 128 |
|
127 | 129 | SimpleScrollbars.prototype.setScrollTop = function(pos) { |
128 | | - this.vert.moveTo(pos, false); |
| 130 | + this.vert.setPos(pos); |
129 | 131 | }; |
130 | 132 |
|
131 | 133 | SimpleScrollbars.prototype.setScrollLeft = function(pos) { |
132 | | - this.horiz.moveTo(pos, false); |
| 134 | + this.horiz.setPos(pos); |
133 | 135 | }; |
134 | 136 |
|
135 | 137 | SimpleScrollbars.prototype.clear = function() { |
|
0 commit comments