Prevent ResizableCornerComponent from getting stuck offscreen

Hi all,
I’m trying to stop the ResizableCornerComponent from being dragged too far.

I found setMinimumOnScreenAmounts, but I’m not sure if that’s the right way.

PluginEditor.h (partly)

PluginProcessor& processor;
ResizableCornerComponent resizer;
ComponentBoundsConstrainer sizeLimits;
double widthToHeightRatio = 0;

const int defaultWidth = 627;
const int defaultHeight = 409;
MainWindow mainWindow;

PluginEditor.cpp

PluginEditor::PluginEditor (PluginProcessor& p) :
    AudioProcessorEditor (&p),
    processor (p),
    resizer (this, &sizeLimits),
    sizeLimits(),
    mainWindow(p)
{
    addAndMakeVisible(mainWindow);

    widthToHeightRatio = static_cast <float> (defaultHeight) / static_cast <float> (defaultWidth);

    auto screen = Desktop::getInstance().getDisplays().getMainDisplay().userArea;
    sizeLimits.setMinimumWidth (defaultWidth);
    sizeLimits.setMaximumSize(screen.getWidth(), screen.getHeight());
    sizeLimits.setMinimumOnscreenAmounts(XXX, XXX, XXX, XXX);
    addAndMakeVisible (resizer);
}  

I tried a couple of params for setMinimumOnscreenAmounts (0, 0xffffff, 16 …), but it doesn’t seem to stop me from dragging the resizableCornerComponent offscreen.

If it goes of screen there is no way to make the plugin window smaller again.

Thanks