litegraph.js icon indicating copy to clipboard operation
litegraph.js copied to clipboard

Slider widget ignoring step value

Open DarioCorno opened this issue 6 years ago • 1 comments

Slider widgets actually ignores the step value. A simple workaround I used is to put the following code:

w.value = Math.ceil( w.value / w.options.step ) * w.options.step;

inside the LGraphCanvas.prototype.processNodeWidgets function, right after the w.value assignment. The final code I'm using looks like:

w.value =
          w.options.min +
          (w.options.max - w.options.min) * nvalue;
w.value = Math.ceil( w.value / w.options.step ) * w.options.step;

By the way, great tool, I'm enjoying to use.

DarioCorno avatar Nov 07 '19 18:11 DarioCorno

I see, I added the step for the numerical widget, not for the slider but I will add it in the next update. Thanks :)

jagenjo avatar Nov 07 '19 18:11 jagenjo