mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-28 02:30:05 +00:00
Ensure that the target point in MenuWindow::getParentArea() is always in terms of screen coordinates
This commit is contained in:
parent
32bb8f5bbc
commit
511e01c400
1 changed files with 5 additions and 2 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue