diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index d070d2d163..90bbd3180c 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -46,6 +46,37 @@ void ScrollBar::gui_input(const Ref &p_event) { Ref b = p_event; + Ref pg = p_event; + + if (pg.is_valid()) { + accept_event(); + + if (orientation == HORIZONTAL) { + if (pg->get_delta().x != 0) { + if (pg->get_delta().x < 0) { + scroll(-MAX(fabsf(pg->get_delta().x), get_step())); + } + if (pg->get_delta().x > 0) { + scroll(MAX(pg->get_delta().x, get_step())); + } + } else if (pg->get_delta().y != 0) { + if (pg->get_delta().y < 0) { + scroll(-MAX(fabsf(pg->get_delta().y), get_step())); + } + if (pg->get_delta().y > 0) { + scroll(MAX(pg->get_delta().y, get_step())); + } + } + } else { + if (pg->get_delta().y < 0) { + scroll(-MAX(fabsf(pg->get_delta().y), get_step())); + } + if (pg->get_delta().y > 0) { + scroll(MAX(pg->get_delta().y, get_step())); + } + } + } + if (b.is_valid()) { accept_event();