mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
NSViewComponentPeer: Properly constrain zoomed window size onto current display
This commit is contained in:
parent
12b7a8f9d1
commit
1edb56df71
1 changed files with 7 additions and 5 deletions
|
|
@ -2353,19 +2353,21 @@ private:
|
|||
#endif
|
||||
}
|
||||
|
||||
static NSRect windowWillUseStandardFrame (id self, SEL, NSWindow*, NSRect)
|
||||
static NSRect windowWillUseStandardFrame (id self, SEL, NSWindow*, NSRect r)
|
||||
{
|
||||
if (auto* owner = getOwner (self))
|
||||
{
|
||||
if (auto* constrainer = owner->getConstrainer())
|
||||
{
|
||||
return flippedScreenRect (makeNSRect (owner->getFrameSize().addedTo (owner->getComponent().getScreenBounds()
|
||||
.withWidth (constrainer->getMaximumWidth())
|
||||
.withHeight (constrainer->getMaximumHeight()))));
|
||||
const auto originalBounds = owner->getFrameSize().addedTo (owner->getComponent().getScreenBounds()).toFloat();
|
||||
const auto expanded = originalBounds.withWidth ((float) constrainer->getMaximumWidth())
|
||||
.withHeight ((float) constrainer->getMaximumHeight());
|
||||
const auto constrained = expanded.constrainedWithin (convertToRectFloat (flippedScreenRect (r)));
|
||||
return flippedScreenRect (makeNSRect (constrained));
|
||||
}
|
||||
}
|
||||
|
||||
return makeNSRect (Rectangle<int> (10000, 10000));
|
||||
return r;
|
||||
}
|
||||
|
||||
static BOOL windowShouldZoomToFrame (id self, SEL, NSWindow* window, NSRect frame)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue