Make EditorSpinSlider wait for text on key_up/down

(cherry picked from commit 3f3cd15e07)
This commit is contained in:
Francois Belair 2021-10-26 16:38:45 -04:00 committed by Rémi Verschelde
parent d6ada73063
commit cf89cf6643
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 14 additions and 2 deletions

View File

@ -230,7 +230,8 @@ void EditorSpinSlider::_value_input_gui_input(const Ref<InputEvent> &p_event) {
set_value(last_value + real_step);
}
value_input->set_text(get_text_value());
value_input_dirty = true;
set_process_internal(true);
} break;
case KEY_DOWN: {
_evaluate_input_text();
@ -243,7 +244,8 @@ void EditorSpinSlider::_value_input_gui_input(const Ref<InputEvent> &p_event) {
set_value(last_value - real_step);
}
value_input->set_text(get_text_value());
value_input_dirty = true;
set_process_internal(true);
} break;
}
}
@ -371,6 +373,14 @@ void EditorSpinSlider::_notification(int p_what) {
value_input->add_style_override("normal", stylebox);
} break;
case NOTIFICATION_INTERNAL_PROCESS:
if (value_input_dirty) {
value_input_dirty = false;
value_input->set_text(get_text_value());
}
set_process_internal(false);
break;
case NOTIFICATION_DRAW:
_draw_spin_slider();
break;
@ -590,6 +600,7 @@ EditorSpinSlider::EditorSpinSlider() {
value_input->connect("focus_exited", this, "_value_focus_exited");
value_input->connect("gui_input", this, "_value_input_gui_input");
value_input_just_closed = false;
value_input_dirty = false;
hide_slider = false;
read_only = false;
use_custom_label_color = false;

View File

@ -64,6 +64,7 @@ class EditorSpinSlider : public Range {
LineEdit *value_input;
bool value_input_just_closed;
bool value_input_dirty;
void _grabber_gui_input(const Ref<InputEvent> &p_event);
void _value_input_closed();