Skip to content

Commit

Permalink
Merge pull request #61479 from kleonc/popupmenu-fix-hover-stylebox-ov…
Browse files Browse the repository at this point in the history
…erflow-3x

[3.x] `PopupMenu` Fix `hover` stylebox overflowing horizontally
  • Loading branch information
akien-mga authored May 27, 2022
2 parents 53843de + 736b0c4 commit b541b57
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scene/gui/popup_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ void PopupMenu::_notification(int p_what) {
Ref<StyleBox> labeled_separator_left = get_stylebox("labeled_separator_left");
Ref<StyleBox> labeled_separator_right = get_stylebox("labeled_separator_right");

style->draw(ci, Rect2(Point2(), get_size()));
style->draw(ci, Rect2(Point2(), size));
Point2 ofs = style->get_offset();
int vseparation = get_constant("vseparation");
int hseparation = get_constant("hseparation");
Expand Down Expand Up @@ -552,6 +552,7 @@ void PopupMenu::_notification(int p_what) {

if (i == mouse_over) {
hover->draw(ci, Rect2(item_ofs + Point2(-hseparation, -vseparation / 2), Size2(get_size().width - style->get_minimum_size().width + hseparation * 2, h + vseparation)));
hover->draw(ci, Rect2(item_ofs + Point2(0, -vseparation / 2), Size2(size.width - style->get_minimum_size().width, h + vseparation)));
}

item_ofs.x += items[i].h_ofs;
Expand Down

0 comments on commit b541b57

Please sign in to comment.