From fb70833bc52aedffa3ed0764a31b706dd1fb3250 Mon Sep 17 00:00:00 2001 From: Cheng-Han, Wu Date: Wed, 1 Jun 2016 14:37:28 +0800 Subject: Update CodeMirror to version 5.15.3 --- public/vendor/codemirror/addon/scroll/simplescrollbars.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'public/vendor/codemirror/addon/scroll/simplescrollbars.js') diff --git a/public/vendor/codemirror/addon/scroll/simplescrollbars.js b/public/vendor/codemirror/addon/scroll/simplescrollbars.js index 32ba2f35..23f3e03f 100644 --- a/public/vendor/codemirror/addon/scroll/simplescrollbars.js +++ b/public/vendor/codemirror/addon/scroll/simplescrollbars.js @@ -59,10 +59,10 @@ CodeMirror.on(this.node, "DOMMouseScroll", onWheel); } - Bar.prototype.setPos = function(pos) { + Bar.prototype.setPos = function(pos, force) { if (pos < 0) pos = 0; if (pos > this.total - this.screen) pos = this.total - this.screen; - if (pos == this.pos) return false; + if (!force && pos == this.pos) return false; this.pos = pos; this.inner.style[this.orientation == "horizontal" ? "left" : "top"] = (pos * (this.size / this.total)) + "px"; @@ -76,9 +76,12 @@ var minButtonSize = 10; Bar.prototype.update = function(scrollSize, clientSize, barSize) { - this.screen = clientSize; - this.total = scrollSize; - this.size = barSize; + var sizeChanged = this.screen != clientSize || this.total != scrollSize || this.size != barSize + if (sizeChanged) { + this.screen = clientSize; + this.total = scrollSize; + this.size = barSize; + } var buttonSize = this.screen * (this.size / this.total); if (buttonSize < minButtonSize) { @@ -87,7 +90,7 @@ } this.inner.style[this.orientation == "horizontal" ? "width" : "height"] = buttonSize + "px"; - this.setPos(this.pos); + this.setPos(this.pos, sizeChanged); }; function SimpleScrollbars(cls, place, scroll) { -- cgit v1.2.3