summaryrefslogtreecommitdiff
path: root/public/vendor/codemirror/addon/scroll
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-04-20 18:11:40 +0800
committerCheng-Han, Wu2016-04-20 18:11:40 +0800
commit8bf516263c6582771e7576e8484ca8cfaa8cb9cb (patch)
treeaba81172f554a50466a762db99f25e3650d7ff45 /public/vendor/codemirror/addon/scroll
parentedc3a31dfdb03e910d7355144280e281eeb582d5 (diff)
Update CodeMirror to 5.13.5
Diffstat (limited to 'public/vendor/codemirror/addon/scroll')
-rw-r--r--public/vendor/codemirror/addon/scroll/simplescrollbars.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/public/vendor/codemirror/addon/scroll/simplescrollbars.js b/public/vendor/codemirror/addon/scroll/simplescrollbars.js
index f78353a1..32ba2f35 100644
--- a/public/vendor/codemirror/addon/scroll/simplescrollbars.js
+++ b/public/vendor/codemirror/addon/scroll/simplescrollbars.js
@@ -59,16 +59,20 @@
CodeMirror.on(this.node, "DOMMouseScroll", onWheel);
}
- Bar.prototype.moveTo = function(pos, update) {
+ Bar.prototype.setPos = function(pos) {
if (pos < 0) pos = 0;
if (pos > this.total - this.screen) pos = this.total - this.screen;
- if (pos == this.pos) return;
+ if (pos == this.pos) return false;
this.pos = pos;
this.inner.style[this.orientation == "horizontal" ? "left" : "top"] =
(pos * (this.size / this.total)) + "px";
- if (update !== false) this.scroll(pos, this.orientation);
+ return true
};
+ Bar.prototype.moveTo = function(pos) {
+ if (this.setPos(pos)) this.scroll(pos, this.orientation);
+ }
+
var minButtonSize = 10;
Bar.prototype.update = function(scrollSize, clientSize, barSize) {
@@ -83,8 +87,7 @@
}
this.inner.style[this.orientation == "horizontal" ? "width" : "height"] =
buttonSize + "px";
- this.inner.style[this.orientation == "horizontal" ? "left" : "top"] =
- this.pos * (this.size / this.total) + "px";
+ this.setPos(this.pos);
};
function SimpleScrollbars(cls, place, scroll) {
@@ -111,7 +114,6 @@
if (needsV) {
this.vert.update(measure.scrollHeight, measure.clientHeight,
measure.viewHeight - (needsH ? width : 0));
- this.vert.node.style.display = "block";
this.vert.node.style.bottom = needsH ? width + "px" : "0";
}
if (needsH) {
@@ -125,11 +127,11 @@
};
SimpleScrollbars.prototype.setScrollTop = function(pos) {
- this.vert.moveTo(pos, false);
+ this.vert.setPos(pos);
};
SimpleScrollbars.prototype.setScrollLeft = function(pos) {
- this.horiz.moveTo(pos, false);
+ this.horiz.setPos(pos);
};
SimpleScrollbars.prototype.clear = function() {