Browse Source

Ensure that the target point in MenuWindow::getParentArea() is always in terms of screen coordinates

tags/2021-05-28
ed 7 years ago
parent
commit
511e01c400
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      modules/juce_gui_basics/menus/juce_PopupMenu.cpp

+ 5
- 2
modules/juce_gui_basics/menus/juce_PopupMenu.cpp View File

@@ -592,8 +592,11 @@ struct MenuWindow : public Component
}
//==============================================================================
Rectangle<int> getParentArea (Point<int> targetPoint)
Rectangle<int> getParentArea (Point<int> targetPoint, Component* relativeTo = nullptr)
{
if (relativeTo != nullptr)
targetPoint = relativeTo->localPointToGlobal (targetPoint);
auto parentArea = Desktop::getInstance().getDisplays().getDisplayContaining (targetPoint)
#if JUCE_MAC
.userArea;
@@ -789,7 +792,7 @@ struct MenuWindow : public Component
windowPos.getHeight() - (PopupMenuSettings::scrollZone + m->getHeight())),
currentY);
auto parentArea = getParentArea (windowPos.getPosition()) / scaleFactor;
auto parentArea = getParentArea (windowPos.getPosition(), parentComponent) / scaleFactor;
auto deltaY = wantedY - currentY;
windowPos.setSize (jmin (windowPos.getWidth(), parentArea.getWidth()),


Loading…
Cancel
Save