mirror of
https://github.com/emilk/egui.git
synced 2026-06-27 07:03:14 -04:00
Add clamp_to_range option to DragValue, rename clamp_range to range (deprecating the former) (#4728)
Adds the ability to have `DragValue` not clamp values its presented with and instead apply clamping only once there's any user input. In action: https://github.com/emilk/egui/assets/1220815/af42fd67-86d0-4364-8ae6-48a2ec15646a Alternative name could be `only_clamp_on_change`, not entirely certain which one is better 🤔
This commit is contained in:
@@ -47,7 +47,7 @@ impl eframe::App for PlotExample {
|
||||
ui.horizontal(|ui| {
|
||||
ui.add(
|
||||
DragValue::new(&mut self.zoom_speed)
|
||||
.clamp_range(0.1..=2.0)
|
||||
.range(0.1..=2.0)
|
||||
.speed(0.1),
|
||||
);
|
||||
ui.label("Zoom speed").on_hover_text("How fast to zoom in and out with the mouse wheel");
|
||||
@@ -55,7 +55,7 @@ impl eframe::App for PlotExample {
|
||||
ui.horizontal(|ui| {
|
||||
ui.add(
|
||||
DragValue::new(&mut self.scroll_speed)
|
||||
.clamp_range(0.1..=100.0)
|
||||
.range(0.1..=100.0)
|
||||
.speed(0.1),
|
||||
);
|
||||
ui.label("Scroll speed").on_hover_text("How fast to pan with the mouse wheel");
|
||||
|
||||
Reference in New Issue
Block a user