georgealways/lil-gui

Wrong step increment for number slider

vkuchinov opened this issue · 1 comments

Here is a small piece of code:

const gui = new GUI(); const params = { num: 2760 }; gui.add(params, 'num', 2200, 3000, 80);

The slider should consists of numbers starting from 2200 to 3000 with a step of 80, however it twists the sequence from its second number [2200, 2240, ... 3000], while it has to be [2200, 2280, ... 3000].

The right sequence which has to be at slider is 2200, 2280, 2360, 2440, 2520, 2600, 2680, 2760, 2840, 2920, 3000.

I have tried to set a step parameters with gui.add(params, 'num', 2200, 3000, 80).step(80); with same glitchy result.

Hi! Thanks for reporting this. Right, I think this is because the range you're giving isn't divisible by step. But the desired behavior you're describing is very reasonable. I'll look into this.

Thanks! -g