From 249521670de023030e41b1ee4edfc10ec0b5f1e5 Mon Sep 17 00:00:00 2001 From: Bernhard Liebl Date: Sun, 7 Jan 2018 02:19:11 +0100 Subject: Corrects wrong scrolling for short popups broken in 15405 --- scene/gui/popup_menu.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'scene') diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index d7987d4a19..cf01ce8643 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -305,11 +305,15 @@ void PopupMenu::_gui_input(const Ref &p_event) { case BUTTON_WHEEL_DOWN: { - _scroll(-b->get_factor(), b->get_position()); + if (get_global_position().y + get_size().y > get_viewport_rect().size.y) { + _scroll(-b->get_factor(), b->get_position()); + } } break; case BUTTON_WHEEL_UP: { - _scroll(b->get_factor(), b->get_position()); + if (get_global_position().y < 0) { + _scroll(b->get_factor(), b->get_position()); + } } break; case BUTTON_LEFT: { @@ -380,7 +384,9 @@ void PopupMenu::_gui_input(const Ref &p_event) { Ref pan_gesture = p_event; if (pan_gesture.is_valid()) { - _scroll(-pan_gesture->get_delta().y, pan_gesture->get_position()); + if (get_global_position().y + get_size().y > get_viewport_rect().size.y || get_global_position().y < 0) { + _scroll(-pan_gesture->get_delta().y, pan_gesture->get_position()); + } } } -- cgit v1.2.3