Repository navigation
Add ValueSlider, a slider whose number stays readable - #622
Merged
Merged
Conversation
ImGuiWidgets.ValueSlider (float and int) draws a frame filled up to the value with the value centered and nothing drawn over it. Drags are relative, Shift drags finely, Ctrl+click types, and a double-click resets to ValueSliderOptions.ResetValue or types when there is none. Options add a number format, a unit suffix and a bipolar fill from zero. The frame and label are one item, as with ImGui.SliderFloat, so IsItemActivated and IsItemDeactivatedAfterEdit work after it. Adds a demo section, an isolation suite, unit tests for the ImGui-free ValueSliderState, and a gallery tile. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VX31mmLGVNK3y28fjKiFmB
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VX31mmLGVNK3y28fjKiFmB
|
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: the only single-value slider was ImGui's own
SliderFloat, whose grab rectangle sits over the number and hides it as you drag.After:
ImGuiWidgets.ValueSlider(float and int) draws a frame filled from the left up to the value, with the formatted value centered and nothing drawn over it. Drag anywhere to change it, Shift to go finely, Ctrl+click to type, and double-click to reset (or to type, when no reset value is set).ValueSliderOptionsadds a number format (by default chosen from the range), a unit suffix such as%,°orpx, a reset value, the fine-drag scale, andValueSliderFill.FromZerofor bipolar ranges such as -100..100. Text over the fill switches to a readable color when the theme's own text color would not read against it.How: the frame and label are one ImGui item (
ItemSize/ItemAdd/ButtonBehavior, asSliderFloatdoes it), and the widget callsMarkItemEdited, so a drop-in replacement forSliderFloatkeeps working withIsItemActivated,IsItemDeactivatedAfterEditand a probe mark taken straight after the call. Only the frame takes the pointer. Drags are relative, so a press never jumps the value. Typing opens anInputTextwith the slider's own id in the same place. Formatting, parsing, drag arithmetic and the fill span live in the ImGui-freeValueSliderState.Added: a demo section, an 18-test isolation suite, 29 unit tests, a demo UI test and a gallery tile. Ran locally: widget unit tests (1074), widget UI tests (737), widgets demo UI tests (53) and gallery UI tests (6), all passing. I also checked it in both themes at 100% and 150%.
🤖 Generated with Claude Code
https://claude.ai/code/session_01VX31mmLGVNK3y28fjKiFmB
Generated by Claude Code