I always desperately wanted different scales in datgui, so I added a scale: 'log' option to range that permits a log scale. It's a bit of code added, so I tried to add all the permutations to the example to make sure that log scale + steps + pos/neg all worked correctly. Some notes:
I wrapped the return value of range in parseFloat(). To the best of my knowledge, the current version returns a number for the initial value, then a string after that (read value from range input = String), which seemed unpleasant.
I quantized the initial value to a step-increment (min + i * step) if steps are specified. This prevents an initial value that is not otherwise achievable. This may or may not be desirable. I'm not 100% sure. Should probably clamp to min/max also.
I had to set oveflow:hidden on the value output since decimal places get a little unwieldy sometimes. Maybe sprintf + '%g'?
I always desperately wanted different scales in datgui, so I added a
scale: 'log'
option torange
that permits a log scale. It's a bit of code added, so I tried to add all the permutations to the example to make sure that log scale + steps + pos/neg all worked correctly. Some notes:parseFloat()
. To the best of my knowledge, the current version returns a number for the initial value, then a string after that (read value from range input = String), which seemed unpleasant.min + i * step
) if steps are specified. This prevents an initial value that is not otherwise achievable. This may or may not be desirable. I'm not 100% sure. Should probably clamp to min/max also.