IonDen / ion.rangeSlider

jQuery only range slider
http://ionden.com/a/plugins/ion.rangeSlider/en.html
MIT License
2.56k stars 508 forks source link

Inconsistent from/to in data object 2.3.0 #639

Open Karel-van-de-Plassche opened 5 years ago

Karel-van-de-Plassche commented 5 years ago

Given three sliders one with min/max/step, one with a numeric values array and one with string values array. The data object in the slide callbacks is:

min/max/step:

from: 5 // FROM value, as expected
from_pretty: "5" // FROM value prettified
from_value: null // null, as expected as the values array is not used

numeric values:

from: 2 // FROM value, instead this is the index
from_pretty: "2" // The index prettyfied?
from_value: 3.141592 // FROM index in values array (if used). Instead, this is the value, not the index

string values:

from: 1 // FROM value, instead this is the index
from_pretty: "1" // The index prettyfied?
from_value: "banana" // FROM index in values array (if used). Instead, this is the value, not the index

This can be solved by swapping from and from_value for when the values array is used. The from_value is also confusingly named, I would expect from_index instead. For the three sliders, look here: https://jsfiddle.net/Lhgj1efn/1/

IonDen commented 5 years ago

Hi, @Karel-van-de-Plassche, i will take a look, thanks for spotting confusing points.