dataarts / dat.guiVR

A flexible graphical user interface for changing variables within WebVR.
https://workshop.chromeexperiments.com/examples/guiVR/
Apache License 2.0
311 stars 50 forks source link

"step" option not working the same as old dat.gui #22

Closed customlogic closed 8 years ago

mflux commented 8 years ago

Hm. Step only works on numeric-only sliders:

https://workshop.chromeexperiments.com/examples/gui/#2--Constraining-Input

And not a slider with both min/max? Is that true?

It doesn't quite make sense to have a step when you have both min/max since the slider determines the actual interpolation. I'm not sure if we should be snapping to "nearest x" though.

customlogic commented 8 years ago

Step should work on any numeric slider, with or without min/max. Think of "step" as the spacing between notches in a stick.. step of 0.25 would mean you could have values 0, 0.25, 0.5, 0.75, 1.0.

Here's how dat.gui handles min/max and step https://github.com/dataarts/dat.gui/blob/master/src/dat/controllers/NumberController.js#L73

For example, if you have min=4.0, max=6, and step=0.25, the values that the slider will "snap" to are 4.0, 4.25, 4.5, 4.75, 5.0, 5.25, 5.5, 5.75, 6.0

mflux commented 8 years ago

Completed with 4381b68583be4677dfb4025ac07a6842ac0c92e7