Fix drag_value.edit_string unexpected reset (#2421)
* Fix drag_value.edit_string unexpected reset solve issue #2418 #2370 * Also reset drag_value.edit_string on click * Fix for clippy check
This commit is contained in:
parent
aca3807e43
commit
e7471f1191
1 changed files with 4 additions and 1 deletions
|
@ -379,6 +379,9 @@ impl<'a> Widget for DragValue<'a> {
|
|||
// screen readers.
|
||||
ui.memory().interested_in_focus(id);
|
||||
let is_kb_editing = ui.memory().has_focus(id);
|
||||
if ui.memory().gained_focus(id) {
|
||||
ui.memory().drag_value.edit_string = None;
|
||||
}
|
||||
|
||||
let old_value = get(&mut get_set_value);
|
||||
let mut value = old_value;
|
||||
|
@ -476,7 +479,6 @@ impl<'a> Widget for DragValue<'a> {
|
|||
ui.memory().drag_value.edit_string = Some(value_text);
|
||||
response
|
||||
} else {
|
||||
ui.memory().drag_value.edit_string = None;
|
||||
let button = Button::new(
|
||||
RichText::new(format!("{}{}{}", prefix, value_text.clone(), suffix)).monospace(),
|
||||
)
|
||||
|
@ -497,6 +499,7 @@ impl<'a> Widget for DragValue<'a> {
|
|||
}
|
||||
|
||||
if response.clicked() {
|
||||
ui.memory().drag_value.edit_string = None;
|
||||
ui.memory().request_focus(id);
|
||||
} else if response.dragged() {
|
||||
ui.output().cursor_icon = CursorIcon::ResizeHorizontal;
|
||||
|
|
Loading…
Reference in a new issue