summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-05-19 22:24:05 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2020-05-19 22:24:05 +0200
commit8dc62a745cb5ce8f8f93440f711135bc11bb70b8 (patch)
tree6e6b104e61acc96ad237dadd952ab9d026049def
parent0a63636e8e5ef6ebcae056e3cf2194a7792d228f (diff)
downloadgdx-boardgame-8dc62a745cb5ce8f8f93440f711135bc11bb70b8.zip
gdx-boardgame-8dc62a745cb5ce8f8f93440f711135bc11bb70b8.tar.gz
ui/Container : check children visibility
-rw-r--r--core/src/ch/asynk/gdx/boardgame/ui/Container.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/ui/Container.java b/core/src/ch/asynk/gdx/boardgame/ui/Container.java
index c9cff4e..a107847 100644
--- a/core/src/ch/asynk/gdx/boardgame/ui/Container.java
+++ b/core/src/ch/asynk/gdx/boardgame/ui/Container.java
@@ -71,10 +71,11 @@ public class Container extends Element
if ((dirty || damaged || resized) && children != null) {
if (direction == Direction.HORIZONTAL) {
// packs at the end
- int n = children.size();
+ int n = 0;
int m = 0;
int c = 0;
for (Element e : children) {
+ if (!e.visible) continue;
e.computeDimensions();
c += e.rect.width;
if (Sizing.contains(e.sizing, Sizing.EXPAND_X)) m += 1;
@@ -84,6 +85,7 @@ public class Container extends Element
boolean end = (pack == Pack.END);
if (end) subArea.x += subArea.width;
for (Element e : children) {
+ if (!e.visible) continue;
float available = e.rect.width;
if (Sizing.contains(e.sizing, Sizing.EXPAND_X))
available += f;
@@ -93,10 +95,11 @@ public class Container extends Element
if (!end) subArea.x += available;
}
} else if (direction == Direction.VERTICAL) {
- int n = children.size();
+ int n = 0;
int m = 0;
int c = 0;
for (Element e : children) {
+ if (!e.visible) continue;
e.computeDimensions();
c += e.rect.height;
if (Sizing.contains(e.sizing, Sizing.EXPAND_Y)) m += 1;
@@ -106,6 +109,7 @@ public class Container extends Element
boolean begin = (pack == Pack.BEGIN);
if (begin) subArea.y += subArea.height;
for (Element e : children) {
+ if (!e.visible) continue;
float available = e.rect.height;
if (Sizing.contains(e.sizing, Sizing.EXPAND_Y))
available += f;