Skip to content

Commit

Permalink
Allow captions to be centered
Browse files Browse the repository at this point in the history
  • Loading branch information
ffAudio committed Jul 1, 2021
1 parent deb8504 commit 9a329d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Layout/foleys_Decorator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ Decorator::ClientBounds Decorator::getClientBounds (juce::Rectangle<int> overall

if (caption.isNotEmpty())
{
if (justification.getOnlyVerticalFlags() & juce::Justification::top)
if (justification == juce::Justification::centred)
captionBox = overallBounds;
else if (justification.getOnlyVerticalFlags() & juce::Justification::top)
captionBox = box.removeFromTop (captionSize).toNearestInt();
else if (justification.getOnlyVerticalFlags() & juce::Justification::bottom)
captionBox = box.removeFromBottom (captionSize).toNearestInt();
Expand Down Expand Up @@ -183,7 +185,7 @@ void Decorator::configure (MagicGUIBuilder& builder, const juce::ValueTree& node
captionSize = static_cast<float> (sizeVar);

auto placementVar = builder.getStyleProperty (IDs::captionPlacement, node);
if (! placementVar.isVoid())
if (! placementVar.isVoid() && placementVar.toString().isNotEmpty())
justification = juce::Justification (makeJustificationsChoices()[placementVar.toString()]);
else
justification = juce::Justification::centredTop;
Expand Down
1 change: 1 addition & 0 deletions VERSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ PluginGuiMagic - Versions history
- Added Filmstrip option for knobs
- Added aspect ratio to resize constrainer
- Added interval and suffix to Slider (not with parameter)
- Allow caption to be centered
- Removed `FOLEYS_SAVE_EDITED_GUI_IN_PLUGIN_STATE`
- Fixed default GUI creation

Expand Down

0 comments on commit 9a329d5

Please sign in to comment.