From bcf6df7c57cdc07bf8ab71fbb28c6623f2d293e8 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Fri, 13 Sep 2013 20:54:23 +0200 Subject: [PATCH] Setting to turn off label ellipse. f201abec80d03dcc7417522763b5dcb0ecada272 --- gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Label.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 631d8733e..42adab3cb 100644 --- a/gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Label.java +++ b/gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Label.java @@ -46,6 +46,7 @@ public class Label extends Widget { private float lastPrefHeight; private boolean sizeInvalid = true; private float fontScaleX = 1, fontScaleY = 1; + private boolean ellipse = true; public Label (CharSequence text, Skin skin) { this(text, skin.get(LabelStyle.class)); @@ -151,7 +152,7 @@ public class Label extends Widget { float width = getWidth(), height = getHeight(); StringBuilder text; - if (width < bounds.width) { + if (ellipse && width < bounds.width) { float ellipseWidth = font.getBounds("...").width; text = tempText != null ? tempText : (tempText = new StringBuilder()); text.setLength(0); @@ -289,6 +290,11 @@ public class Label extends Widget { invalidateHierarchy(); } + /** When true the text will be truncated with an ellipse if it does not fit within the width of the label. Default is true. */ + public void setEllipse (boolean ellipse) { + this.ellipse = ellipse; + } + /** The style for a label, see {@link Label}. * @author Nathan Sweet */ static public class LabelStyle { -- 2.11.0