Make EditorSpinSlider wait for text on key_up/down

This commit is contained in:
Francois Belair 2021-10-26 16:38:45 -04:00
parent 8c162f4a7b
commit 3f3cd15e07
2 changed files with 13 additions and 2 deletions

View file

@ -225,7 +225,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();
@ -238,7 +239,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;
}
}
@ -424,6 +426,14 @@ void EditorSpinSlider::_notification(int p_what) {
_update_value_input_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;

View file

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