Page 1 of 1

Displaying a decimal

PostPosted: Tue Apr 09, 2013 2:13 pm
by robhillis
Is it possible to return a decimal number rather than a whole number with the slider?

Re: Displaying a decimal

PostPosted: Wed Apr 24, 2013 10:46 am
by tigra
You'll have to modify function f_sliderSetValue inside of slider.js
Replace:
Code: Select all
   // round to closest multiple if step is specified
   if (this.n_step)
      n_value = Math.round((n_value - this.n_minValue) / this.n_step) * this.n_step + this.n_minValue;
   // smooth out the result
   if (n_value % 1)
      n_value = Math.round(n_value * 1e5) / 1e5;

with
Code: Select all
   if (this.n_step)
      n_value = ((n_value - this.n_minValue) / this.n_step) * this.n_step + this.n_minValue;