From 0a4a67d4392f517ea984982e57db7c480685bec0 Mon Sep 17 00:00:00 2001 From: reuk Date: Mon, 24 May 2021 19:40:47 +0100 Subject: [PATCH] PopupMenu: Use correct alignment for submenus with large borders --- modules/juce_gui_basics/menus/juce_PopupMenu.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp index dcbe7fac7b..9af574885e 100644 --- a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp +++ b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp @@ -854,8 +854,9 @@ struct MenuWindow : public Component if (getLookAndFeel().getPopupMenuBorderSizeWithOptions (options) == 0) // workaround for dismissing the window on mouse up when border size is 0 x += tendTowardsRight ? 1 : -1; - y = target.getCentreY() > parentArea.getCentreY() ? jmax (parentArea.getY(), target.getBottom() - heightToUse) - : target.getY(); + const auto border = getLookAndFeel().getPopupMenuBorderSizeWithOptions (options); + y = target.getCentreY() > parentArea.getCentreY() ? jmax (parentArea.getY(), target.getBottom() - heightToUse) + border + : target.getY() - border; } x = jmax (parentArea.getX() + 1, jmin (parentArea.getRight() - (widthToUse + 6), x));