Permalink
Browse files

Fix Divide by Zero bug in translateToPx()

Bug that drove me insane hunting down and fixing back in 2010.  Found
the bug is still in the latest version so I applied it to the latest
branch.  If I recall correctly it fails SILENTLY with no errors and
sliders that just don't work. Took days to initially find the problem.
  • Loading branch information...
hackerceo committed Jun 18, 2015
1 parent 1e63ff3 commit 5d67466089a2461f9cdbe6a2a995ef71a713c982
Showing with 1 addition and 0 deletions.
  1. +1 −0 src/slider.js
View
@@ -148,6 +148,7 @@ Control.Slider = Class.create({
handleIdx || this.activeHandleIdx || 0);
},
translateToPx: function(value) {
if ((this.range.end-this.range.start)==0) { return "0px"; }
return Math.round(
((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) *
(value - this.range.start)) + "px";

0 comments on commit 5d67466

Please sign in to comment.