From 099c7bcbbd7f00e8d32917c552ee9e3a1e6125ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= <jeremy@asynk.ch>
Date: Mon, 9 Nov 2015 23:19:37 +0100
Subject: Label: must update width and height before calling
 setPosition(Position)

---
 core/src/ch/asynk/rustanddust/ui/Label.java | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/core/src/ch/asynk/rustanddust/ui/Label.java b/core/src/ch/asynk/rustanddust/ui/Label.java
index 6a6d809..1bff1ba 100644
--- a/core/src/ch/asynk/rustanddust/ui/Label.java
+++ b/core/src/ch/asynk/rustanddust/ui/Label.java
@@ -54,6 +54,7 @@ public class Label extends Widget
     public void write(String text)
     {
         this.text = text;
+        compute();
         setPosition(position);
     }
 
@@ -63,6 +64,13 @@ public class Label extends Widget
         setPosition(x, y);
     }
 
+    private void compute()
+    {
+        this.layout.setText(font, (text == null) ? "" : text);
+        this.rect.width = (layout.width + (2 * padding));
+        this.rect.height = (layout.height + (2 * padding));
+    }
+
     @Override
     public void draw(Batch batch)
     {
-- 
cgit v1.1-2-g2b99