mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Fix UI focus being shown when it shouldn't
This commit is contained in:
parent
06faefc9f4
commit
e32b9274a3
7 changed files with 39 additions and 16 deletions
|
|
@ -277,6 +277,7 @@ void EditorSpinSlider::_value_input_gui_input(const Ref<InputEvent> &p_event) {
|
|||
case Key::ESCAPE: {
|
||||
value_input_closed_frame = Engine::get_singleton()->get_frames_drawn();
|
||||
if (value_input_popup) {
|
||||
value_input_focus_visible = value_input->has_focus(true);
|
||||
value_input_popup->hide();
|
||||
}
|
||||
} break;
|
||||
|
|
@ -612,6 +613,7 @@ void EditorSpinSlider::_evaluate_input_text() {
|
|||
void EditorSpinSlider::_value_input_submitted(const String &p_text) {
|
||||
value_input_closed_frame = Engine::get_singleton()->get_frames_drawn();
|
||||
if (value_input_popup) {
|
||||
value_input_focus_visible = value_input->has_focus(true);
|
||||
value_input_popup->hide();
|
||||
}
|
||||
}
|
||||
|
|
@ -646,9 +648,10 @@ void EditorSpinSlider::_value_focus_exited() {
|
|||
value_input_popup->hide();
|
||||
}
|
||||
} else {
|
||||
// Enter or Esc was pressed.
|
||||
grab_focus();
|
||||
// Enter or Esc was pressed. Keep showing the focus if already present.
|
||||
grab_focus(!value_input_focus_visible);
|
||||
}
|
||||
value_input_focus_visible = false;
|
||||
|
||||
emit_signal("value_focus_exited");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ class EditorSpinSlider : public Range {
|
|||
LineEdit *value_input = nullptr;
|
||||
uint64_t value_input_closed_frame = 0;
|
||||
bool value_input_dirty = false;
|
||||
bool value_input_focus_visible = false;
|
||||
|
||||
public:
|
||||
enum ControlState {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue