diff options
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/ui/Scrollable.java | 9 |
1 files changed, 4 insertions, 5 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) { |