OSDN Git Service

Added getPageScrollX/Y.
authorNathanSweet <nathan.sweet@gmail.com>
Sun, 29 Sep 2013 21:35:03 +0000 (23:35 +0200)
committerNathanSweet <nathan.sweet@gmail.com>
Sun, 29 Sep 2013 21:35:03 +0000 (23:35 +0200)
http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=10988

gdx/src/com/badlogic/gdx/scenes/scene2d/ui/ScrollPane.java

index 6b58827..8e621f2 100644 (file)
@@ -123,7 +123,7 @@ public class ScrollPane extends WidgetGroup {
                                                draggingPointer = pointer;\r
                                                return true;\r
                                        }\r
-                                       setScrollX(amountX + areaWidth * (x < hKnobBounds.x ? -1 : 1));\r
+                                       setScrollX(amountX + getPageScrollX() * (x < hKnobBounds.x ? -1 : 1));\r
                                        return true;\r
                                }\r
                                if (scrollY && vScrollBounds.contains(x, y)) {\r
@@ -136,7 +136,7 @@ public class ScrollPane extends WidgetGroup {
                                                draggingPointer = pointer;\r
                                                return true;\r
                                        }\r
-                                       setScrollY(amountY + areaHeight * (y < vKnobBounds.y ? 1 : -1));\r
+                                       setScrollY(amountY + getPageScrollY() * (y < vKnobBounds.y ? 1 : -1));\r
                                        return true;\r
                                }\r
                                return false;\r
@@ -647,6 +647,16 @@ public class ScrollPane extends WidgetGroup {
                this.visualAmountY = pixelsY;\r
        }\r
 \r
+       /** Returns the amount to scroll horizontally when the scrollbar is clicked. */\r
+       protected float getPageScrollX () {\r
+               return areaWidth;\r
+       }\r
+\r
+       /** Returns the amount to scroll vertically when the scrollbar is clicked. */\r
+       protected float getPageScrollY () {\r
+               return areaHeight;\r
+       }\r
+\r
        public void setScrollX (float pixels) {\r
                scrollX(MathUtils.clamp(pixels, 0, maxX));\r
        }\r