-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add trailing_fill()
toggle to Slider
#2660
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very nice feature!
But I wonder if we can come up with a better name for it. trailing_fill
?
I also think the option belong in egui::Visuals
instead of (or addition to) having it for every slider. Presumably a user would want to turn this on for all sliders, or none of them?
trailing_color()
toggle to Slider
trailing_fill()
toggle to Slider
Suggestions added. The option is now in ui.add(Slider::new(&mut my_slider_value, 0.0..=100.0)); // No fill (default)
ui.add(Slider::new(&mut my_slider_value, 0.0..=100.0).trailing_fill(true)); // Fill (override)
ui.visuals_mut().slider_trailing_fill = true;
ui.add(Slider::new(&mut my_slider_value, 0.0..=100.0)); // Fill (global)
ui.add(Slider::new(&mut my_slider_value, 0.0..=100.0).trailing_fill(false)); // No fill (override) The |
thanks! |
* slider: add trailing_color toggle * slider/visuals: add global option in visuals with override toggle * slider: add to demos * use `.unwrap_or_else()` instead of match
Adds a boolean toggle to
Slider
that enables trailing color behind the circle. The color used is the same as aProgressBar
, it is sourced fromui.visuals().selection.bg_fill
.Usage:
Before:
After:
Vertical & Horizontal: