diff --git a/libs/tote_bag/juce_gui/components/panels/InfoPanel.cpp b/libs/tote_bag/juce_gui/components/panels/InfoPanel.cpp index eae68644..81108b6b 100644 --- a/libs/tote_bag/juce_gui/components/panels/InfoPanel.cpp +++ b/libs/tote_bag/juce_gui/components/panels/InfoPanel.cpp @@ -37,13 +37,49 @@ InfoPanel::~InfoPanel() void InfoPanel::paint (juce::Graphics& g) { - const auto bounds = getLocalBounds(); - g.setColour (colours::plainWhite); - g.fillRect (bounds); + g.fillRect (getLocalBounds()); drawWatermark (g); + drawInfoText (g); +} + +void InfoPanel::mouseUp (const juce::MouseEvent& e) +{ + if (urlBounds.contains (e.getPosition())) + { + githubURL.launchInDefaultBrowser(); + } + else + { + onMouseUp(); + } +} +void InfoPanel::drawWatermark (juce::Graphics& g) +{ + const auto bounds = getLocalBounds(); + const auto boundsWidth = bounds.getWidth(); + const auto boundsHeight = bounds.getHeight(); + + const auto totieX = bounds.getX() + (boundsWidth * .28f); + const auto totieY = bounds.getY() - (boundsHeight * .08f); + const auto totieHeight = boundsHeight * 1.22f; + const auto totieBounds = + bounds.withX (totieX) + .withY (totieY) + .withHeight (totieHeight) + .withWidth (totieHeight * detail::kTotieWidthHeightRatio); + + totieWatermark->drawWithin (g, + totieBounds.toFloat(), + juce::RectanglePlacement::stretchToFit, + 1.0f); +} + +void InfoPanel::drawInfoText (juce::Graphics& g) +{ + const auto bounds = getLocalBounds(); const auto boundsWidth = bounds.getWidth(); const auto boundsHeight = bounds.getHeight(); @@ -82,37 +118,4 @@ void InfoPanel::paint (juce::Graphics& g) urlBounds = placeText ("Github"); } -void InfoPanel::mouseUp (const juce::MouseEvent& e) -{ - if (urlBounds.contains (e.getPosition())) - { - githubURL.launchInDefaultBrowser(); - } - else - { - onMouseUp(); - } -} - -void InfoPanel::drawWatermark (juce::Graphics& g) -{ - const auto bounds = getLocalBounds(); - const auto boundsWidth = bounds.getWidth(); - const auto boundsHeight = bounds.getHeight(); - - const auto totieX = bounds.getX() + (boundsWidth * .28f); - const auto totieY = bounds.getY() - (boundsHeight * .08f); - const auto totieHeight = boundsHeight * 1.22f; - const auto totieBounds = - bounds.withX (totieX) - .withY (totieY) - .withHeight (totieHeight) - .withWidth (totieHeight * detail::kTotieWidthHeightRatio); - - totieWatermark->drawWithin (g, - totieBounds.toFloat(), - juce::RectanglePlacement::stretchToFit, - 1.0f); -} - } // namespace tote_bag \ No newline at end of file diff --git a/libs/tote_bag/juce_gui/components/panels/InfoPanel.h b/libs/tote_bag/juce_gui/components/panels/InfoPanel.h index 9781a4da..8bd1d7d1 100644 --- a/libs/tote_bag/juce_gui/components/panels/InfoPanel.h +++ b/libs/tote_bag/juce_gui/components/panels/InfoPanel.h @@ -24,6 +24,7 @@ class InfoPanel : public juce::Component private: void drawWatermark (juce::Graphics& g); + void drawInfoText (juce::Graphics& g); std::function onMouseUp;