diff --git a/source/touch/Thumb.js b/source/touch/Thumb.js index 2c6ad8c32..de84ff58c 100644 --- a/source/touch/Thumb.js +++ b/source/touch/Thumb.js @@ -22,38 +22,40 @@ this.update(inStrategy); }, update: function(inStrategy) { - var d = this.dimension, o = this.offset; - var bd = this.scrollBounds[this.sizeDimension], sbd = this.scrollBounds[d]; - var overs = 0, overp = 0, over = 0; - if (bd >= sbd) { - this.hide(); - return; - } - if (inStrategy.isOverscrolling()) { - over = inStrategy.getOverScrollBounds()["over" + o]; - overs = Math.abs(over); - overp = Math.max(over, 0); - } - var sbo = inStrategy[this.positionMethod]() - over; - // calc size & position - var bdc = bd - this.cornerSize; - var s = Math.floor((bd * bd / sbd) - overs); - s = Math.max(this.minSize, s); - var p = Math.floor((bdc * sbo / sbd) + overp); - p = Math.max(0, Math.min(bdc - this.minSize, p)); - // apply thumb styling - this.needed = s < bd; - if (this.needed && this.hasNode()) { - if (this._pos !== p) { - this._pos = p; - enyo.dom.transformValue(this, this.translation, p + "px"); + if (this.showing) { + var d = this.dimension, o = this.offset; + var bd = this.scrollBounds[this.sizeDimension], sbd = this.scrollBounds[d]; + var overs = 0, overp = 0, over = 0; + if (bd >= sbd) { + this.hide(); + return; + } + if (inStrategy.isOverscrolling()) { + over = inStrategy.getOverScrollBounds()["over" + o]; + overs = Math.abs(over); + overp = Math.max(over, 0); } - if (this._size !== s) { - this._size = s; - this.node.style[d] = this.domStyles[d] = s + "px"; + var sbo = inStrategy[this.positionMethod]() - over; + // calc size & position + var bdc = bd - this.cornerSize; + var s = Math.floor((bd * bd / sbd) - overs); + s = Math.max(this.minSize, s); + var p = Math.floor((bdc * sbo / sbd) + overp); + p = Math.max(0, Math.min(bdc - this.minSize, p)); + // apply thumb styling + this.needed = s < bd; + if (this.needed && this.hasNode()) { + if (this._pos !== p) { + this._pos = p; + enyo.dom.transformValue(this, this.translation, p + "px"); + } + if (this._size !== s) { + this._size = s; + this.node.style[d] = this.domStyles[d] = s + "px"; + } + } else { + this.hide(); } - } else { - this.hide(); } }, // implement set because showing is not changed while