diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2020-05-13 07:31:28 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2020-05-13 07:31:28 +0200 |
commit | eabe011521ec6684dc6a01c4753a2347559ffd59 (patch) | |
tree | 74349aea7a087eb884b76d28b46b8adecd92e68b /core/src/ch/asynk | |
parent | 3629647d1338f81d6604ec3e623c89d283f746cf (diff) | |
download | gdx-boardgame-eabe011521ec6684dc6a01c4753a2347559ffd59.zip gdx-boardgame-eabe011521ec6684dc6a01c4753a2347559ffd59.tar.gz |
ui/Button : is always sized according to it's Label
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/ui/Button.java | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/ui/Button.java b/core/src/ch/asynk/gdx/boardgame/ui/Button.java index 9ba4dad..69bec27 100644 --- a/core/src/ch/asynk/gdx/boardgame/ui/Button.java +++ b/core/src/ch/asynk/gdx/boardgame/ui/Button.java @@ -27,7 +27,6 @@ public class Button extends Patch this.spacing = spacing; this.label = new Label(font); this.label.setParent(this, Alignment.MIDDLE_CENTER); - this.sizing = Sizing.EXPAND_BOTH; } public void write(String text) @@ -43,17 +42,11 @@ public class Button extends Patch @Override public void computeDimensions() { - if(sizing.fill()) { - super.computeDimensions(); - } else { - float dd = 2 * (padding + spacing); - label.computeDimensions(); - if (sizing.expandWidth()) - rect.width = label.getWidth() + dd; - if (sizing.expandHeight()) - rect.height = label.getHeight() + dd; - if (DEBUG_GEOMETRY) System.err.println(" dim " + print(-1)); - } + float dd = 2 * (padding + spacing); + label.computeDimensions(); + rect.width = label.getWidth() + dd; + rect.height = label.getHeight() + dd; + if (DEBUG_GEOMETRY) System.err.println(" dim " + print(-1)); } @Override public void computePosition() |