Feature: Set DragValue speed from Slider constructor
- Dominant language
- Rust
- Stars
- 30.6k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 72
Description
**Is your feature request related to a problem? Please describe.**
I want to allow my user to enter accurate values using a slider. Currently the only way to get a resolution higher than the sliders width in pixels is to manually edit the DragValue. Dragging it only modifies it in the same increments as the slider, even if the slider has a smaller step.
**Describe the solution you'd like**
A: `Slider.dragvalue_speed(0.1)` setter
B: Slider.set_step to affect DragValue speed directly
**Describe alternatives you've considered**
- Instructing the user to hold shift which devides the DragValue speed by 10.
- Slider being affected by speed too. would lead to distance between cursor and slider handle.
**Additional context**
Slider with step of 0.1 and dragvalue with a speed of 0.1

eframe test code
```rust
use eframe::{
egui::{CentralPanel, Context, DragValue, Slider},
run_native, App, NativeOptions,
};
struct Test(f32);
impl App for Test {
fn update(&mut self, ctx: &Context, _: &mut eframe::Frame) {
CentralPanel::default().show(ctx, |ui| {
ui.spacing_mut().slider_width = 100.0;
ui.add(
Slider::new(&mut self.0, 0.0..=255.)
.text("0-255")
.step_by(0.1),
);
ui.add(DragValue::new(&mut self.0).speed(0.1));
});
}
}
fn main() {
run_native(
"test",
NativeOptions::default(),
Box::new(|_| Box::new(Test(0.0))),
);
}
```
Contributor guide
Research direction
Start with the provided egui example and trace how Slider::step_by and DragValue::speed affect the shared value during dragging. Decide whether the requested API or direct step-to-speed behavior fits the existing Slider and DragValue interfaces, then verify that a slider with a 0.1 step permits the demonstrated higher-resolution input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100