-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added actual logarithmic sliders #1316
Conversation
@AndrewBelt Looking at this now, how do you think the equivalent code would work with |
@AndrewBelt Going to clarify my question a little bit.
It would be beneficial to rework the Slider interaction to:
So Slider's internal will likely work more like Drag in the future. (To support new data types such as double and u64 I need to rework some of the logic. e.g. DragFloat may need some sort of "accumulator". But how/when to flush this accumulator into the target value is tricky because the format-string rounding round-trip would have an effect on the target value from half of the minimum step. Need to store the difference back into the accumulator, etc. Anyway it is solvable and I'll implement that soon. But that'll have to be worked along with support for non-linear edition) |
I haven't looked at DragFloat in a while, but if it works through relative values, you could simply multiply a factor on each mouse delta rather than adding it. For linear incrementing, you probably do something like
For logarithmic parameters, you'd do
|
Sorry to bump this request but implementation of proper logarithmic sliders is a must! The last comment of @AndrewBelt should be enough information to properly implement it. If not I'll do it myself :) |
I haven’t had time to look into this, feel free to expand on this PR but also please read my message carefully, consider the use of keyboard/gamepad navigation inputs and DragFloat. |
@AndrewBelt @gijsbel We went quick down the rabbit hole with this, see: (May attempt to split-reformulate #3361 into two steps one taking this approach it (power=0.0f == logarithmic) and then all the other code to change signature.) |
This is now fully implemented by #3361, finally closing :) |
The slider behavior previously called "logarithmic" is actually polynomial. This is true logarithmic and can be triggered by passing a
power
argument of0.0f
inSliderFloat
.I left the previous behavior for backwards compatibility, but in my opinion it should be removed and the
float power
argument should be changed tobool logarithmic
.Also updated demo for "slider log float".
Solves #642