diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-10-03 08:39:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-03 08:39:38 +0200 |
commit | ff9bbf1818d62d8eb336a6a0f29357824a00b366 (patch) | |
tree | b465fb756b8663b5b02f0c0758cb2ff071bde963 | |
parent | 5db77dceb8c5de24d1ead43bb965bcbedf3f06a7 (diff) | |
parent | 03d6291aafd2b05b5f4d5d75688bb61ecbe91e61 (diff) |
Merge pull request #32490 from mrcdk/tree_scroll_scrollcontainer
Handle scrolling correctly in Tree controls inside ScrollContainers
-rw-r--r-- | scene/gui/tree.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 2fc4be6900..50b0b12029 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2677,11 +2677,21 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { } break; case BUTTON_WHEEL_UP: { + double prev_value = v_scroll->get_value(); v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * b->get_factor() / 8); + if (v_scroll->get_value() != prev_value) { + accept_event(); + } + } break; case BUTTON_WHEEL_DOWN: { + double prev_value = v_scroll->get_value(); v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * b->get_factor() / 8); + if (v_scroll->get_value() != prev_value) { + accept_event(); + } + } break; } } @@ -2689,7 +2699,11 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { Ref<InputEventPanGesture> pan_gesture = p_event; if (pan_gesture.is_valid()) { + double prev_value = v_scroll->get_value(); v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * pan_gesture->get_delta().y / 8); + if (v_scroll->get_value() != prev_value) { + accept_event(); + } } } |