Fix touch release event on _gui_input
This commit is contained in:
parent
f11047aa81
commit
7491e910f3
@ -1727,6 +1727,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
|||||||
|
|
||||||
gui.mouse_focus = _gui_find_control(pos);
|
gui.mouse_focus = _gui_find_control(pos);
|
||||||
gui.mouse_focus_mask = 1 << (mb->get_button_index() - 1);
|
gui.mouse_focus_mask = 1 << (mb->get_button_index() - 1);
|
||||||
|
gui.last_mouse_focus = gui.mouse_focus;
|
||||||
|
|
||||||
if (!gui.mouse_focus) {
|
if (!gui.mouse_focus) {
|
||||||
return;
|
return;
|
||||||
@ -2114,14 +2115,14 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
|||||||
set_input_as_handled();
|
set_input_as_handled();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (gui.mouse_focus) {
|
} else if (touch_event->get_index() == 0 && gui.last_mouse_focus) {
|
||||||
|
|
||||||
if (gui.mouse_focus->can_process()) {
|
if (gui.last_mouse_focus->can_process()) {
|
||||||
|
|
||||||
touch_event = touch_event->xformed_by(Transform2D()); //make a copy
|
touch_event = touch_event->xformed_by(Transform2D()); //make a copy
|
||||||
touch_event->set_position(gui.focus_inv_xform.xform(pos));
|
touch_event->set_position(gui.focus_inv_xform.xform(pos));
|
||||||
|
|
||||||
_gui_call_input(gui.mouse_focus, touch_event);
|
_gui_call_input(gui.last_mouse_focus, touch_event);
|
||||||
}
|
}
|
||||||
set_input_as_handled();
|
set_input_as_handled();
|
||||||
return;
|
return;
|
||||||
|
@ -271,6 +271,7 @@ private:
|
|||||||
|
|
||||||
bool key_event_accepted;
|
bool key_event_accepted;
|
||||||
Control *mouse_focus;
|
Control *mouse_focus;
|
||||||
|
Control *last_mouse_focus;
|
||||||
Control *mouse_click_grabber;
|
Control *mouse_click_grabber;
|
||||||
int mouse_focus_mask;
|
int mouse_focus_mask;
|
||||||
Control *key_focus;
|
Control *key_focus;
|
||||||
|
Loading…
Reference in New Issue
Block a user