1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added some more places where we can use the BorderSize from a Label's LookAndFeel

This commit is contained in:
Tom Poole 2018-09-04 12:47:30 +01:00
parent 0165e066b2
commit 02f8a125c4
3 changed files with 9 additions and 6 deletions

View file

@ -155,19 +155,21 @@ void Label::attachToComponent (Component* owner, bool onLeft)
void Label::componentMovedOrResized (Component& component, bool /*wasMoved*/, bool /*wasResized*/)
{
auto f = getLookAndFeel().getLabelFont (*this);
auto& lf = getLookAndFeel();
auto f = lf.getLabelFont (*this);
auto border = lf.getLabelBorderSize (*this);
if (leftOfOwnerComp)
{
auto width = jmin (roundToInt (f.getStringWidthFloat (textValue.toString()) + 0.5f)
+ getBorderSize().getLeftAndRight(),
+ border.getLeftAndRight(),
component.getX());
setBounds (component.getX() - width, component.getY(), width, component.getHeight());
}
else
{
auto height = getBorderSize().getTopAndBottom() + 6 + roundToInt (f.getHeight() + 0.5f);
auto height = border.getTopAndBottom() + 6 + roundToInt (f.getHeight() + 0.5f);
setBounds (component.getX(), component.getY() - height, component.getWidth(), height);
}