Open caracal7 opened 8 years ago
It depends on your scenario, having a dynamically updated range from obj settings is not possible with your current suggestion. Mixing step with range is not a good idea imho. But i did already move the range to the config obj (current state https://github.com/automat/controlkit.js/blob/rewrite/src/component/Slider.js#L54 ,v 0.2 branch https://github.com/automat/controlkit.js/tree/rewrite) so it can be omitted (assuming a default mapping range from 0 to 1, or 0 to value if the mapped value is larger than one) as well as having the option to either pass an array directly or an object key to the config so its still possible to have a dynamic range eg. depending on other values of the settings obj which get manipulated using other input components.
// This is not good because you need add to OBJ unnecessary variables. var obj = {value:0,range:[-1,1]}; panel.addSlider(obj,'value','range');
// This is ok)) var obj = {value:0}; panel.addSlider(obj,'value',range:[-1,1,0.1]); // Or this var obj = {value:0}; panel.addSlider(obj,'value',{step:0.1, range:[-1,1]});
Sorry for my english(