From 0d7c84c3277187ce80e611ee68d58a942228a6ab Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 31 Mar 2021 22:18:45 +0200 Subject: [PATCH] Make each DragValue at least the size of interact_size --- egui/src/style.rs | 2 +- egui/src/widgets/drag_value.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/egui/src/style.rs b/egui/src/style.rs index 693f0ba3..2bec3fe2 100644 --- a/egui/src/style.rs +++ b/egui/src/style.rs @@ -74,7 +74,7 @@ pub struct Spacing { /// Indent collapsing regions etc by this much. pub indent: f32, - /// Minimum size of e.g. a button (including padding). + /// Minimum size of a `DragValue`, color picker button, and other small widgets. /// `interact_size.y` is the default height of button, slider, etc. /// Anything clickable should be (at least) this size. pub interact_size: Vec2, // TODO: rename min_interact_size ? diff --git a/egui/src/widgets/drag_value.rs b/egui/src/widgets/drag_value.rs index 72c118a2..dbf55d6c 100644 --- a/egui/src/widgets/drag_value.rs +++ b/egui/src/widgets/drag_value.rs @@ -261,7 +261,7 @@ impl<'a> Widget for DragValue<'a> { let button = Button::new(format!("{}{}{}", prefix, value_text, suffix)) .sense(Sense::click_and_drag()) .text_style(TextStyle::Monospace); - let response = ui.add(button); + let response = ui.add_sized(ui.spacing().interact_size, button); let response = response.on_hover_text(format!( "{}{}{}\nDrag to edit or click to enter a value.", prefix,