summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-02-24 10:22:41 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-02-24 10:22:41 +0100
commit75f72498a57a07c7b855901ebbcabdfb5781e567 (patch)
treecdec0f1fa6cc735c635a5a20b737b3106d0c7d1a /core/src/ch
parent69051769e9cd46652f17936684e1ff44c247f5e5 (diff)
downloadRustAndDust-75f72498a57a07c7b855901ebbcabdfb5781e567.zip
RustAndDust-75f72498a57a07c7b855901ebbcabdfb5781e567.tar.gz
Scrollable: add getBestHeight(), simplify setPosition()
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/rustanddust/ui/Scrollable.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/src/ch/asynk/rustanddust/ui/Scrollable.java b/core/src/ch/asynk/rustanddust/ui/Scrollable.java
index 7548239..9f7ff2c 100644
--- a/core/src/ch/asynk/rustanddust/ui/Scrollable.java
+++ b/core/src/ch/asynk/rustanddust/ui/Scrollable.java
@@ -46,6 +46,11 @@ public class Scrollable extends Widget
return (child.getWidth() + (2 * padding));
}
+ public float getBestHeight()
+ {
+ return (child.getHeight() + (2 * padding));
+ }
+
public boolean drag(float x, float y, int dx, int dy)
{
child.translate(0, dy);
@@ -66,8 +71,8 @@ public class Scrollable extends Widget
public void setPosition(float x, float y, float w, float h)
{
rect.set(x, y, w, h);
- child.setPosition((x + padding), (getTop() - padding - child.getHeight()));
- clip.set((getX() + padding), (getY() + padding), (getWidth() - (2 * padding)), (getHeight() - (2 * padding)));
+ child.setPosition((x + padding), (y + padding), (w - 2 * padding), (h - 2 * padding));
+ clip.set((x + padding), (y + padding), (w - 2 * padding), (h - 2 * padding));
}
@Override