diff --git a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp index 4a4597e362..f58b886f75 100644 --- a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp +++ b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp @@ -1095,7 +1095,7 @@ struct MenuWindow final : public Component { const auto parentArea = getParentArea (windowPos.getPosition(), options.getParentComponent()) / scaleFactor; - if (const auto posAndOffset = computeInitialPosAndOffset (windowPos, parentArea, itemComp.getBounds(), childYOffset, wantedY)) + if (const auto posAndOffset = computeInitialPosAndOffset (windowPos, parentArea, itemComp.getBounds(), wantedY)) { std::tie (windowPos, childYOffset) = std::tie (posAndOffset->windowPos, posAndOffset->childYOffset); updateYPositions(); @@ -1111,7 +1111,6 @@ struct MenuWindow final : public Component static std::optional computeInitialPosAndOffset (Rectangle windowPos, const Rectangle& parentArea, const Rectangle& itemCompBounds, - int childYOffset, int wantedY) { if (windowPos.getHeight() <= PopupMenuSettings::scrollZone * 4 @@ -1135,10 +1134,9 @@ struct MenuWindow final : public Component parentArea.getBottom() - windowPos.getHeight(), deltaY); - childYOffset -= (deltaY - newY); windowPos.setPosition (windowPos.getX(), newY); - return PosAndOffset { windowPos, childYOffset }; + return PosAndOffset { windowPos, newY - deltaY }; } void resizeToBestWindowPos()