From ad01fa2248e9a4f11373011d4d6290f726185f18 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 20 Jun 2016 17:16:52 -0300 Subject: [PATCH] Allow mouse wheel to go throuhgh so scroll containers work properly, fixes #4431 (cherry picked from commit 85d8000449be06affcd686838d498be186594c14) --- scene/main/viewport.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 9e31a5324b7..344478e48cd 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1481,6 +1481,14 @@ void Viewport::_gui_call_input(Control *p_control,const InputEvent& p_input) { // _block(); + + //mouse wheel events can't be stopped + bool cant_stop_me_now = (p_input.type==InputEvent::MOUSE_BUTTON && + (p_input.mouse_button.button_index==BUTTON_WHEEL_DOWN || + p_input.mouse_button.button_index==BUTTON_WHEEL_UP || + p_input.mouse_button.button_index==BUTTON_WHEEL_LEFT || + p_input.mouse_button.button_index==BUTTON_WHEEL_RIGHT ) ); + CanvasItem *ci=p_control; while(ci) { @@ -1496,7 +1504,7 @@ void Viewport::_gui_call_input(Control *p_control,const InputEvent& p_input) { break; if (gui.key_event_accepted) break; - if (control->data.stop_mouse && (p_input.type==InputEvent::MOUSE_BUTTON || p_input.type==InputEvent::MOUSE_MOTION)) + if (!cant_stop_me_now && control->data.stop_mouse && (p_input.type==InputEvent::MOUSE_BUTTON || p_input.type==InputEvent::MOUSE_MOTION)) break; }