summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/ch/asynk/gdx/boardgame/ui/Scrollable.java9
-rw-r--r--test/src/ch/asynk/gdx/boardgame/test/UiScreen.java2
2 files changed, 5 insertions, 6 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/ui/Scrollable.java b/core/src/ch/asynk/gdx/boardgame/ui/Scrollable.java
index 14d22b7..3aab8b0 100644
--- a/core/src/ch/asynk/gdx/boardgame/ui/Scrollable.java
+++ b/core/src/ch/asynk/gdx/boardgame/ui/Scrollable.java
@@ -67,14 +67,13 @@ public class Scrollable extends Element
float tx = 0;
float ty = 0;
if (vScroll) {
- if (dy > 0 && child.rect.y < innerRect.y) {
- ty = Math.min(dy, innerRect.y - child.rect.y);
- }
- else if (dy < 0) {
+ if (dy < 0 && child.rect.y < innerRect.y) {
+ ty = Math.min(-dy, innerRect.y - child.rect.y);
+ } else if (dy > 0) {
float cly = innerRect.y + innerRect.height;
float chy = child.rect.y + child.rect.height;
if (chy > cly)
- ty = Math.max(dy, cly - chy);
+ ty = -Math.min(dy, chy - cly);
}
}
if (hScroll) {
diff --git a/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java b/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java
index 319ffab..ce78892 100644
--- a/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java
+++ b/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java
@@ -211,7 +211,7 @@ public class UiScreen extends AbstractScreen
{
hudTouch.set(dragPos.x, dragPos.y, 0);
camera.unproject(hudTouch);
- root.drag(hudTouch.x, hudTouch.y, -dx, dy);
+ root.drag(hudTouch.x, hudTouch.y, dx, dy);
}
}