Skip to content

[minor] Add logarithmic and prefix options to ValueSlider and keep its number clear near zero - #625

Merged
matt-edmondson merged 2 commits into
mainfrom
claude/project-thread-xka0g5
Oct 11, 2026
Merged

matt-edmondson merged 2 commits into
mainfrom
claude/project-thread-xka0g5

Conversation

@matt-edmondson

@matt-edmondson matt-edmondson commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Matt · project thread

Before: ValueSlider could only cover its range linearly, so sizes and radii that were logarithmic ImGui.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.Logarithmic makes each stretch of a drag multiply the value by the same factor, and ValueSliderOptions.Prefix writes 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, Drag take logarithmic/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. FillAvoidsText decides 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, and TryParse ignores 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

…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
@matt-edmondson matt-edmondson self-assigned this Oct 11, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018BGac9LmQV495Bsnrmo1b7
@matt-edmondson matt-edmondson changed the title [minor] Add a logarithmic mode to ValueSlider and keep its number clear near zero [minor] Add logarithmic and prefix options to ValueSlider and keep its number clear near zero Oct 11, 2026
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit e344d7a into main Oct 11, 2026
17 checks passed
@matt-edmondson
matt-edmondson deleted the claude/project-thread-xka0g5 branch October 11, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants