1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-18 00:54:19 +00:00

Tweaked the Label class to take its border into account when positioning relative to a target component.

This commit is contained in:
jules 2015-03-23 18:13:07 +00:00
parent fce4188055
commit 90c88ec416

View file

@ -162,7 +162,8 @@ void Label::componentMovedOrResized (Component& component, bool /*wasMoved*/, bo
if (leftOfOwnerComp)
{
setSize (jmin (f.getStringWidth (textValue.toString()) + 8, component.getX()),
setSize (jmin (roundToInt (f.getStringWidthFloat (textValue.toString()) + 0.5f) + getBorderSize().getLeftAndRight(),
component.getX()),
component.getHeight());
setTopRightPosition (component.getX(), component.getY());
@ -170,7 +171,7 @@ void Label::componentMovedOrResized (Component& component, bool /*wasMoved*/, bo
else
{
setSize (component.getWidth(),
8 + roundToInt (f.getHeight()));
getBorderSize().getTopAndBottom() + 6 + roundToInt (f.getHeight() + 0.5f));
setTopLeftPosition (component.getX(), component.getY() - getHeight());
}