Skip to content

Commit

Permalink
Corrected text selection in color picker
Browse files Browse the repository at this point in the history
Fixes godotengine#35603

(cherry picked from commit 77b70aa)
  • Loading branch information
Janglee123 authored and akien-mga committed Apr 16, 2020
1 parent a51e785 commit e1ca49b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions scene/gui/color_picker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit e1ca49b

Please sign in to comment.