Offset of the CallOutBox


It seems that the juce::CallOutBox is sometimes shifted vertically to the bottom. In this example, the juce::CallOutBox is not attached to a component and should display a rectangle with its origin at the mouse position. I tested on macOS and Windows with Juce 6.1.2 (master) and 96612b1 (develop).

I click at the bottom of the window and the position seems good:

I click at the top of the window and the position seems bad:


void MainComponent::mouseDown (juce::MouseEvent const& e)
    class Rect
    : public juce::Component
            setSize(300, 200);
        void paint (juce::Graphics& g) override
    juce::CallOutBox::launchAsynchronously(std::make_unique<Rect>(), {e.getScreenX(), e.getScreenY(), 300, 200}, nullptr);

Your areaToPointTo in the launchAsynchronously is a big square with top left position at the cursor. IIRC according to the quarter where you click in the screen, the CallOutBox will be placed Up or Down or Left or Right to this areaToPointTo target (with the arrow pointed to the area).

In _Good it is Up ; in _Bad it is Down.

Thus for me it seems a normal behaviour. Am i wrong? :thinking:

You should use a smaller size for the target to see what i mean (and click on screen borders).

juce::CallOutBox::launchAsynchronously(std::make_unique<Rect>(), {e.getScreenX(), e.getScreenY(), 10, 10}, nullptr);
1 Like

Okay, I expected the CallOutBox to be placed in the rectangle but in fact, this is the area that the call-out’s arrow should point towards. I should have read the documentation more carefully. Thank you!

1 Like