dataarts / dat.gui

Lightweight controller library for JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

High precision number controller

callumacrae opened this issue · comments

I've ran into an issue in my project where the precision of a slider isn't high enough for me, so I've ended up having two slides for every value where one goes between 0 and 1 and the other goes between -0.01 and 0.01, and they're added together when they're used:

image

I've read through the code and I don't think it's anything there's an option for, I think it's literally the resolution of my screen causing the issue. It would be really great if I didn't have to do that, though 😅

So, how about if when a user holds shift when dragging the sliders, it ignores the value under the mouse and instead divides the distance the mouse has moved by 10 or 50 or something like that for a high precision adjustment? Kind of like how on iOS when watching a video you can move your finger away from the time bar and it slows the speed you're panning down relative to the same movement over the actual slider.

It slightly breaks the model of how sliders work right now (as it's a relative change from the slider, not an absolute change), but I can't see it breaking anyones workflow unless they're doing something like hiding dat.gui unless they're holding shift.

Thoughts? Happy to have a crack at a PR if you'd be willing to accept it :)