From 8dc62a745cb5ce8f8f93440f711135bc11bb70b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 19 May 2020 22:24:05 +0200 Subject: ui/Container : check children visibility --- core/src/ch/asynk/gdx/boardgame/ui/Container.java | 8 ++++++-- 1 file 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; -- cgit v1.1-2-g2b99