Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible Slider enhancement #28

Open
caracal7 opened this issue Sep 19, 2016 · 1 comment
Open

Possible Slider enhancement #28

caracal7 opened this issue Sep 19, 2016 · 1 comment

Comments

@caracal7
Copy link

// 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(

@automat
Copy link
Owner

automat commented Sep 19, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants