changeset 1040:59fa7b6ae9f7

fixed 2 tiny bugs in TinyRange
author hertzhaft
date Thu, 22 Mar 2012 16:38:32 +0100
parents aef8a02e7ea5
children 81c2378f12ff
files webapp/src/main/webapp/jquery/jquery.range.js
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/jquery.range.js	Thu Mar 22 15:39:25 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.range.js	Thu Mar 22 16:38:32 2012 +0100
@@ -152,7 +152,7 @@
     
     var updateHandles = function(){
 
-      if (options.values){
+      if (options.values != null) {
         if (options.range){
           moveHandle($handle2, valueToPx(options.values[1]), false);
           moveHandle($handle, valueToPx(options.values[0]), false);
@@ -176,7 +176,9 @@
     
     var valueToPx = function(val){
       var w = $input.width();
-      var v = (val*(w/(options.max-options.min)))-options.min;
+      var valspan = options.max - options.min;
+      var valpos = val - options.min;
+      var v = valpos * w / valspan;
       
       return v;
     };