summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/ch/asynk/gdx/tabletop/ui/Button.java3
-rw-r--r--core/src/ch/asynk/gdx/tabletop/ui/Element.java1
-rw-r--r--core/src/ch/asynk/gdx/tabletop/ui/Label.java4
3 files changed, 5 insertions, 3 deletions
diff --git a/core/src/ch/asynk/gdx/tabletop/ui/Button.java b/core/src/ch/asynk/gdx/tabletop/ui/Button.java
index 06688c9..59974a9 100644
--- a/core/src/ch/asynk/gdx/tabletop/ui/Button.java
+++ b/core/src/ch/asynk/gdx/tabletop/ui/Button.java
@@ -44,10 +44,11 @@ public class Button extends Patch
@Override public void computeGeometry()
{
float dd = 2 * (padding + spacing);
+ label.computeGeometry(); // update dimensions
rect.width = label.getWidth() + dd;
rect.height = label.getHeight() + dd;
super.computeGeometry();
- label.computeGeometry();
+ label.computeGeometry(); // update position
}
@Override public void draw(Batch batch)
diff --git a/core/src/ch/asynk/gdx/tabletop/ui/Element.java b/core/src/ch/asynk/gdx/tabletop/ui/Element.java
index 5b3c0fe..b2a015a 100644
--- a/core/src/ch/asynk/gdx/tabletop/ui/Element.java
+++ b/core/src/ch/asynk/gdx/tabletop/ui/Element.java
@@ -111,5 +111,6 @@ public abstract class Element implements Drawable, Touchable
rect.y = y + alignment.getY(parent, rect.height);
}
this.tainted = false;
+ // System.err.println(String.format("%s : %s", this, rect));
}
}
diff --git a/core/src/ch/asynk/gdx/tabletop/ui/Label.java b/core/src/ch/asynk/gdx/tabletop/ui/Label.java
index 55eab83..842597a 100644
--- a/core/src/ch/asynk/gdx/tabletop/ui/Label.java
+++ b/core/src/ch/asynk/gdx/tabletop/ui/Label.java
@@ -40,13 +40,13 @@ public class Label extends Element
{
this.text = text;
this.layout.setText(font, (text == null) ? "" : text);
- this.rect.width = (layout.width + (2 * padding));
- this.rect.height = (layout.height + (2 * padding));
this.tainted = true;
}
@Override protected void computeGeometry()
{
+ this.rect.width = (layout.width + (2 * padding));
+ this.rect.height = (layout.height + (2 * padding));
super.computeGeometry();
fx = getInnerX();
fy = getInnerY() + layout.height;