mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Mark the widgets a DragValue is built from with DragValue::CLASS
A drag value is not a widget of its own: it shows a `Button` while you drag it and a `TextEdit` while you type into it. A `StyleProvider` asked to style either had no way to tell it apart from a stand-alone one, so it could not style the two states as one control. Set `egui::drag_value` on the drag value itself; it already forwards its classes to both. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -71,6 +71,9 @@ pub struct DragValue<'a> {
|
||||
impl<'a> DragValue<'a> {
|
||||
const ATOM_ID: &'static str = "drag_item";
|
||||
|
||||
/// Present on the [`Button`] and the [`TextEdit`] a drag value is built from.
|
||||
pub const CLASS: &'static str = "egui::drag_value";
|
||||
|
||||
pub fn new<Num: emath::Numeric>(value: &'a mut Num) -> Self {
|
||||
let slf = Self::from_get_set(move |v: Option<f64>| {
|
||||
if let Some(v) = v {
|
||||
@@ -100,7 +103,7 @@ impl<'a> DragValue<'a> {
|
||||
custom_formatter: None,
|
||||
custom_parser: None,
|
||||
update_while_editing: true,
|
||||
classes: Classes::default(),
|
||||
classes: Classes::default().with_class(Self::CLASS),
|
||||
min_size: None,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user