diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index 27fdb1cf6d..494958bfd1 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -999,8 +999,10 @@ public: { if (constrainer != nullptr && ! isKioskMode()) { - Rectangle pos (convertToRectInt (flippedScreenRect (r))); - Rectangle original (convertToRectInt (flippedScreenRect ([window frame]))); + const float scale = getComponent().getDesktopScaleFactor(); + + Rectangle pos = ScalingHelpers::unscaledScreenPosToScaled (scale, convertToRectInt (flippedScreenRect (r))); + Rectangle original = ScalingHelpers::unscaledScreenPosToScaled (scale, convertToRectInt (flippedScreenRect ([window frame]))); const Rectangle screenBounds (Desktop::getInstance().getDisplays().getTotalBounds (true)); @@ -1023,6 +1025,8 @@ public: pos.getX() == original.getX() && pos.getRight() != original.getRight()); } + pos = ScalingHelpers::scaledScreenPosToUnscaled (scale, pos); + r = flippedScreenRect (makeNSRect (pos)); }