From 175bbc662149425f4b9f35cde5454ad323646939 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Sun, 6 Jan 2013 10:41:35 +0100 Subject: [PATCH] Label, fixed wrapping text not respecting bg offsets. --- gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Label.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Label.java b/gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Label.java index 705ec2e8e..2cf652442 100644 --- a/gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Label.java +++ b/gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Label.java @@ -122,9 +122,11 @@ public class Label extends Widget { private void computeSize () { sizeInvalid = false; - if (wrap) - bounds.set(cache.getFont().getWrappedBounds(text, getWidth())); - else + if (wrap) { + float width = getWidth(); + if (style.background != null) width -= style.background.getLeftWidth() + style.background.getRightWidth(); + bounds.set(cache.getFont().getWrappedBounds(text, width)); + } else bounds.set(cache.getFont().getMultiLineBounds(text)); bounds.width *= fontScaleX; bounds.height *= fontScaleY; -- 2.11.0