diff options
author | janglee <merupatel123@gmail.com> | 2020-03-24 17:11:09 +0530 |
---|---|---|
committer | Meru Patel <2017180@iiitdmj.ac.in> | 2020-03-25 08:13:31 +0000 |
commit | 77b70aa79d006790168d623821d8e2c3bf505b67 (patch) | |
tree | 7a3de0e6ecff36a996cf12b3a7e520f19dc94e15 /scene/gui | |
parent | 20edf69f96160fcf7c0ea2449f4daf50f572ce99 (diff) |
Corrected text selection in color picker
Fixes #35603
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/color_picker.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index cbbad79811..a8b5ac6909 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -624,26 +624,33 @@ void ColorPicker::_screen_pick_pressed() { } void ColorPicker::_focus_enter() { - if (c_text->has_focus()) { + bool has_ctext_focus = c_text->has_focus(); + if (has_ctext_focus) { c_text->select_all(); - return; + } else { + c_text->select(0, 0); } + for (int i = 0; i < 4; i++) { - if (values[i]->get_line_edit()->has_focus()) { + if (values[i]->get_line_edit()->has_focus() && !has_ctext_focus) { values[i]->get_line_edit()->select_all(); - break; + } else { + values[i]->get_line_edit()->select(0, 0); } } } void ColorPicker::_focus_exit() { for (int i = 0; i < 4; i++) { - values[i]->get_line_edit()->select(0, 0); + if (!values[i]->get_line_edit()->get_menu()->is_visible()) + values[i]->get_line_edit()->select(0, 0); } c_text->select(0, 0); } void ColorPicker::_html_focus_exit() { + if (c_text->get_menu()->is_visible()) + return; _html_entered(c_text->get_text()); _focus_exit(); } |