diff --git a/modules/juce_gui_basics/windows/juce_CallOutBox.cpp b/modules/juce_gui_basics/windows/juce_CallOutBox.cpp index d9f4cf28da..9b877fee5a 100644 --- a/modules/juce_gui_basics/windows/juce_CallOutBox.cpp +++ b/modules/juce_gui_basics/windows/juce_CallOutBox.cpp @@ -23,7 +23,7 @@ */ CallOutBox::CallOutBox (Component& c, const Rectangle& area, Component* const parent) - : borderSpace (20), arrowSize (16.0f), content (c) + : arrowSize (16.0f), content (c) { addAndMakeVisible (content); @@ -86,10 +86,14 @@ CallOutBox& CallOutBox::launchAsynchronously (Component* content, const Rectangl void CallOutBox::setArrowSize (const float newSize) { arrowSize = newSize; - borderSpace = jmax (20, (int) arrowSize); refreshPath(); } +int CallOutBox::getBorderSize() const noexcept +{ + return jmax (20, (int) arrowSize); +} + void CallOutBox::paint (Graphics& g) { getLookAndFeel().drawCallOutBoxBackground (*this, g, outline, background); @@ -97,6 +101,7 @@ void CallOutBox::paint (Graphics& g) void CallOutBox::resized() { + const int borderSpace = getBorderSize(); content.setTopLeftPosition (borderSpace, borderSpace); refreshPath(); } @@ -168,6 +173,8 @@ void CallOutBox::updatePosition (const Rectangle& newAreaToPointTo, const R targetArea = newAreaToPointTo; availableArea = newAreaToFitIn; + const int borderSpace = getBorderSize(); + Rectangle newBounds (content.getWidth() + borderSpace * 2, content.getHeight() + borderSpace * 2); diff --git a/modules/juce_gui_basics/windows/juce_CallOutBox.h b/modules/juce_gui_basics/windows/juce_CallOutBox.h index 51be2f3e8b..a87a52cfbb 100644 --- a/modules/juce_gui_basics/windows/juce_CallOutBox.h +++ b/modules/juce_gui_basics/windows/juce_CallOutBox.h @@ -149,10 +149,11 @@ public: bool keyPressed (const KeyPress&) override; /** @internal */ void handleCommandMessage (int) override; + /** @internal */ + int getBorderSize() const noexcept; private: //============================================================================== - int borderSpace; float arrowSize; Component& content; Path outline;