Skip to content

Commit 0fba007

Browse files
committed
Merge pull request #103155 from Giganzo/popup-menu-shadow
Fix PopupMenu clickable area with shadows
2 parents 7be9852 + 6ac24d2 commit 0fba007

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scene/gui/popup_menu.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
613613
item_clickable_area.position.x += theme_cache.panel_style->get_margin(SIDE_LEFT);
614614
item_clickable_area.position.y += theme_cache.panel_style->get_margin(SIDE_TOP);
615615
item_clickable_area.position *= win_scale;
616+
item_clickable_area.size.width -= theme_cache.panel_style->get_margin(SIDE_LEFT) + theme_cache.panel_style->get_margin(SIDE_RIGHT);
616617
item_clickable_area.size.y -= theme_cache.panel_style->get_margin(SIDE_TOP) + theme_cache.panel_style->get_margin(SIDE_BOTTOM);
617618
item_clickable_area.size *= win_scale;
618619

@@ -626,7 +627,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
626627
if (button_idx == MouseButton::LEFT || initial_button_mask.has_flag(mouse_button_to_mask(button_idx))) {
627628
if (b->is_pressed()) {
628629
during_grabbed_click = false;
629-
is_scrolling = is_layout_rtl() ? b->get_position().x < item_clickable_area.position.x : b->get_position().x > item_clickable_area.size.width;
630+
is_scrolling = is_layout_rtl() ? b->get_position().x < item_clickable_area.position.x - item_clickable_area.size.width : b->get_position().x > item_clickable_area.size.width + item_clickable_area.position.x;
630631

631632
// Hide it if the shadows have been clicked.
632633
if (get_flag(FLAG_POPUP)) {

0 commit comments

Comments
 (0)