From 62626be3f5b3eccce29ad55e3c82d46c788295b3 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Sun, 23 Aug 2009 21:07:06 -0600 Subject: [PATCH] Make sure there is always 1 pixel in slider if we are not at absolute top/bottom --- imp/js/DimpSlider.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/imp/js/DimpSlider.js b/imp/js/DimpSlider.js index ae30b8c9d..6b30e3563 100644 --- a/imp/js/DimpSlider.js +++ b/imp/js/DimpSlider.js @@ -193,9 +193,22 @@ var DimpSlider = Class.create({ this.value = (type == 'val') ? Math.min(Math.max(0, data), this.options.totalsize - this.options.pagesize) : Math.max(0, Math.round(Math.min(data, this.handletop) / this.handletop * (this.options.totalsize - this.options.pagesize))); - this.handlevalue = (type == 'px') - ? data - : Math.round(this.getValue() / (this.options.totalsize - this.options.pagesize) * this.handletop); + + if (type == 'px') { + this.handlevalue = data; + } else { + this.handlevalue = Math.round(this.value / (this.options.totalsize - this.options.pagesize) * this.handletop); + + /* Always make sure there is at least 1 pixel if we are not at the + * absolute bottom or top. */ + if (this.handlevalue == 0 && this.value != 0) { + this.handlevalue += 1; + } else if (this.handlevalue == this.handletop && + ((this.options.totalsize - this.options.pagesize) != this.value)) { + this.handlevalue -= 1; + } + } + this.handle.setStyle({ top: this.handlevalue + 'px' }); }, -- 2.11.0