mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
ComponentBoundsConstrainer: Properly constrain secondary windows in plugins
This commit is contained in:
parent
3e0fa4489a
commit
858aab823a
2 changed files with 4 additions and 2 deletions
|
|
@ -104,7 +104,9 @@ void ComponentBoundsConstrainer::setBoundsForComponent (Component* component,
|
|||
if (auto* parent = component->getParentComponent())
|
||||
return { parent->getWidth(), parent->getHeight() };
|
||||
|
||||
if (auto* display = Desktop::getInstance().getDisplays().getDisplayForPoint (targetBounds.getCentre()))
|
||||
const auto globalBounds = component->localAreaToGlobal (targetBounds - component->getPosition());
|
||||
|
||||
if (auto* display = Desktop::getInstance().getDisplays().getDisplayForPoint (globalBounds.getCentre()))
|
||||
return component->getLocalArea (nullptr, display->userArea) + component->getPosition();
|
||||
|
||||
const auto max = std::numeric_limits<int>::max();
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ void TopLevelWindow::centreAroundComponent (Component* c, const int width, const
|
|||
const auto scale = getDesktopScaleFactor() / Desktop::getInstance().getGlobalScaleFactor();
|
||||
|
||||
auto targetCentre = c->localPointToGlobal (c->getLocalBounds().getCentre()) / scale;
|
||||
auto parentArea = c->getParentMonitorArea();
|
||||
auto parentArea = getLocalArea (nullptr, c->getParentMonitorArea());
|
||||
|
||||
if (auto* parent = getParentComponent())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue