mirror of https://github.com/godotengine/godot
Merge pull request #101246 from wlsnmrk/dropdown-fix
Fix menus and dropdowns requiring two clicks
This commit is contained in:
commit
bfa351cb44
|
|
@ -151,11 +151,13 @@ void BaseButton::_toggled(bool p_pressed) {
|
||||||
void BaseButton::on_action_event(Ref<InputEvent> p_event) {
|
void BaseButton::on_action_event(Ref<InputEvent> p_event) {
|
||||||
Ref<InputEventMouseButton> mouse_button = p_event;
|
Ref<InputEventMouseButton> mouse_button = p_event;
|
||||||
|
|
||||||
if (!status.pressed_down_with_focus && p_event->is_pressed() && (mouse_button.is_null() || status.hovering)) {
|
if (p_event->is_pressed() && (mouse_button.is_null() || status.hovering)) {
|
||||||
status.press_attempt = true;
|
status.press_attempt = true;
|
||||||
status.pressing_inside = true;
|
status.pressing_inside = true;
|
||||||
status.pressed_down_with_focus = true;
|
if (!status.pressed_down_with_focus) {
|
||||||
emit_signal(SNAME("button_down"));
|
status.pressed_down_with_focus = true;
|
||||||
|
emit_signal(SNAME("button_down"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status.press_attempt && status.pressing_inside) {
|
if (status.press_attempt && status.pressing_inside) {
|
||||||
|
|
@ -181,11 +183,13 @@ void BaseButton::on_action_event(Ref<InputEvent> p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status.pressed_down_with_focus && !p_event->is_pressed()) {
|
if (!p_event->is_pressed()) {
|
||||||
status.press_attempt = false;
|
status.press_attempt = false;
|
||||||
status.pressing_inside = false;
|
status.pressing_inside = false;
|
||||||
status.pressed_down_with_focus = false;
|
if (status.pressed_down_with_focus) {
|
||||||
emit_signal(SNAME("button_up"));
|
status.pressed_down_with_focus = false;
|
||||||
|
emit_signal(SNAME("button_up"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
queue_redraw();
|
queue_redraw();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue