mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -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:
@@ -43,15 +43,11 @@ impl CodeExample {
|
||||
r#"
|
||||
ui.add(
|
||||
egui::DragValue::new(age)
|
||||
.clamp_range(0..=120)
|
||||
.range(0..=120)
|
||||
.suffix(" years"),
|
||||
);"#,
|
||||
);
|
||||
ui.add(
|
||||
egui::DragValue::new(age)
|
||||
.clamp_range(0..=120)
|
||||
.suffix(" years"),
|
||||
);
|
||||
ui.add(egui::DragValue::new(age).range(0..=120).suffix(" years"));
|
||||
ui.end_row();
|
||||
|
||||
show_code(
|
||||
|
||||
Reference in New Issue
Block a user