Repository navigation
[minor] Add logarithmic and prefix options to ValueSlider and keep its number clear near zero - #625
Merged
Merged
Conversation
…ar near zero ValueSliderOptions.Logarithmic covers the range logarithmically, so each stretch of a drag multiplies the value by the same factor. A range from zero keeps zero at its left end and runs from the smallest step the format shows; a range below zero mirrors one above it; one crossing zero stays linear. A fill lying wholly under the centred number, such as a value near zero filled from zero, and the zero mark are now drawn only above and below the digits rather than through them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018BGac9LmQV495Bsnrmo1b7
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018BGac9LmQV495Bsnrmo1b7
|
This was referenced Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Requested by Matt · project thread
Before:
ValueSlidercould only cover its range linearly, so sizes and radii that were logarithmicImGui.SliderFloats in ImageGui lost their feel when they moved to it, and it could not put its label inside the frame the way ImageGui's tool row does ("Size 20 px"). A bipolar slider resting at or near zero drew the zero mark, and a sliver of fill, straight through the centred number.After:
ValueSliderOptions.Logarithmicmakes each stretch of a drag multiply the value by the same factor, andValueSliderOptions.Prefixwrites text before the number. Near zero, the fill and zero mark stop above and below the digits, so the number stays readable.How: the mapping lives in the ImGui-free
ValueSliderState(Fraction,ValueAt,Dragtakelogarithmic/epsilon; drags accumulate in position space). A range starting at zero keeps zero at its left end and runs logarithmically from the smallest step the format shows (LogarithmicEpsilon:"0"gives 1,"0.0"gives 0.1), matching ImGui's own logarithmic sliders. A range wholly below zero mirrors one above it; one crossing zero stays linear.FillAvoidsTextdecides when a fill lies wholly under the padded number, and the frame then clips the fill and the zero mark to the strips above and below it. The prefix is left out of the typing editor, andTryParseignores it when typed.Tests: unit tests for the mapping, epsilon, prefix parsing and the avoidance rule; UI tests for a logarithmic drag, a prefix, and a pixel check that nothing crosses the number at -1, 0 and 1 (fails on main at all three). The demo and the gallery tile each gain a logarithmic size slider.
🤖 Generated with Claude Code
https://claude.ai/code/session_018BGac9LmQV495Bsnrmo1b7