summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/gdx/boardgame/ui
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/gdx/boardgame/ui')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/ui/Container.java3
-rw-r--r--core/src/ch/asynk/gdx/boardgame/ui/Element.java11
-rw-r--r--core/src/ch/asynk/gdx/boardgame/ui/Root.java2
3 files changed, 4 insertions, 12 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/ui/Container.java b/core/src/ch/asynk/gdx/boardgame/ui/Container.java
index f12a15d..79e0c45 100644
--- a/core/src/ch/asynk/gdx/boardgame/ui/Container.java
+++ b/core/src/ch/asynk/gdx/boardgame/ui/Container.java
@@ -35,9 +35,8 @@ public class Container extends Element
}
}
- @Override public void taint()
+ public void taintChildren()
{
- super.taint();
if (children != null)
children.forEach( c -> c.taint() );
}
diff --git a/core/src/ch/asynk/gdx/boardgame/ui/Element.java b/core/src/ch/asynk/gdx/boardgame/ui/Element.java
index 5df6587..13b1d42 100644
--- a/core/src/ch/asynk/gdx/boardgame/ui/Element.java
+++ b/core/src/ch/asynk/gdx/boardgame/ui/Element.java
@@ -21,15 +21,9 @@ public abstract class Element implements Drawable, Paddable, Positionable, Touch
protected Rectangle rect; // outer drawing coordinates
protected float x, y; // given position
protected boolean tainted; // geometry must be computed
- public boolean taintParent; // propagate tainted state up the tree
protected Element()
{
- this(false);
- }
-
- protected Element(boolean taintParent)
- {
this.blocked = false;
this.visible = true;
this.padding = 0;
@@ -38,8 +32,7 @@ public abstract class Element implements Drawable, Paddable, Positionable, Touch
this.alignment = alignment.RELATIVE;
this.rect = new Rectangle(0, 0, 0, 0);
this.x = this.y = 0;
- this.tainted = true;
- this.taintParent = taintParent;
+ taint();
}
@Override public final float getX() { return rect.x; }
@@ -81,7 +74,7 @@ public abstract class Element implements Drawable, Paddable, Positionable, Touch
public void taint()
{
this.tainted = true;
- if (parent != null && taintParent) parent.taint();
+ if (parent != null) parent.taint();
}
@Override public void setPosition(float x, float y, float w, float h)
diff --git a/core/src/ch/asynk/gdx/boardgame/ui/Root.java b/core/src/ch/asynk/gdx/boardgame/ui/Root.java
index c3ad0c3..dfa8e04 100644
--- a/core/src/ch/asynk/gdx/boardgame/ui/Root.java
+++ b/core/src/ch/asynk/gdx/boardgame/ui/Root.java
@@ -28,7 +28,7 @@ public class Root extends Container
public void resize(float x, float y, float width, float height)
{
setPosition(x, y, width, height);
- taint();
+ taintChildren();
}
public Element touched()