diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2020-06-04 10:07:55 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2020-06-04 10:07:55 +0200 |
commit | 98438b94388e19e68a8bb2a9673b29966d260814 (patch) | |
tree | d9b16eda65bb6c31f4a4b9ae07ac4e063d0755d4 /core | |
parent | a49f215cfb4570bcc7c38458ce4f5c73c37dfb8a (diff) | |
download | gdx-boardgame-98438b94388e19e68a8bb2a9673b29966d260814.zip gdx-boardgame-98438b94388e19e68a8bb2a9673b29966d260814.tar.gz |
Scrollable : fix ty
Diffstat (limited to 'core')
-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) { |