Skip to content

Commit

Permalink
Standalone - no negative step values
Browse files Browse the repository at this point in the history
  • Loading branch information
abpetkov committed Apr 21, 2014
1 parent 35e53d5 commit 70866fa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion dist/powerange.js
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@ Powerange.prototype.setValue = function (offset, size) {

Powerange.prototype.step = function(sliderSize, handleSize) {
var dimension = sliderSize - handleSize
, part = percentage.from(this.options.step, this.options.max - this.options.min)
, part = percentage.from(this.checkStep(this.options.step), this.options.max - this.options.min)
, interval = percentage.of(part, dimension)
, steps = [];

Expand All @@ -1490,6 +1490,20 @@ Powerange.prototype.checkValues = function(start) {
if (this.options.min >= this.options.max) this.options.min = this.options.max;
};

/**
* Make sure `step` is positive.
*
* @param {Number} value
* @returns {Number} this.options.step
* @api private
*/

Powerange.prototype.checkStep = function(value) {
if (value < 0) value = Math.abs(value);
this.options.step = value;
return this.options.step;
};

/**
* Disable range slider.
*
Expand Down
Loading

0 comments on commit 70866fa

Please sign in to comment.