summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/gdx/boardgame
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2019-12-18 10:27:18 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2019-12-18 10:27:18 +0100
commitb5dee2dc2d6efd124d2e26a3f1c96d28e55329e3 (patch)
treeb86c75b58e9ac65772da198e7f89a424293887f2 /core/src/ch/asynk/gdx/boardgame
parentdd535dc97129dbac3e0521826343e5002f43777b (diff)
downloadgdx-boardgame-b5dee2dc2d6efd124d2e26a3f1c96d28e55329e3.zip
gdx-boardgame-b5dee2dc2d6efd124d2e26a3f1c96d28e55329e3.tar.gz
ui.List : follow taint() computeGeometry() logic
Diffstat (limited to 'core/src/ch/asynk/gdx/boardgame')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/ui/List.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/ui/List.java b/core/src/ch/asynk/gdx/boardgame/ui/List.java
index 19f08f2..e9f874a 100644
--- a/core/src/ch/asynk/gdx/boardgame/ui/List.java
+++ b/core/src/ch/asynk/gdx/boardgame/ui/List.java
@@ -56,6 +56,11 @@ public class List extends Element
{
unselect();
this.items = items;
+ taint();
+ }
+
+ @Override public void computeGeometry()
+ {
float w = 0f;
for (Item e: items) {
layout.setText(font, e.s());
@@ -65,12 +70,14 @@ public class List extends Element
rect.width = w + (2 * padding);
rect.height = (itemHeight * items.size()) + (2 * padding) - spacing;
+ super.computeGeometry();
}
@Override public void draw(Batch batch)
{
if (!visible) return;
+ if (tainted) computeGeometry();
float x = getInnerX();
float y = getInnerTop();
for (Item e : items) {