Class DragScrollListener

  • All Implemented Interfaces:
    EventListener

    public class DragScrollListener
    extends DragListener
    Causes a scroll pane to scroll when a drag goes outside the bounds of the scroll pane. Attach the listener to the actor which will cause scrolling when dragged, usually the scroll pane or the scroll pane's actor.

    If ScrollPane.setFlickScroll(boolean) is true, the scroll pane must have ScrollPane.setCancelTouchFocus(boolean) false. When a drag starts that should drag rather than flick scroll, cancel the scroll pane's touch focus using stage.cancelTouchFocus(scrollPane);. In this case the drag scroll listener must not be attached to the scroll pane, else it would also lose touch focus. Instead it can be attached to the scroll pane's actor.

    If using drag and drop, DragAndDrop.setCancelTouchFocus(boolean) must be false.

    • Constructor Detail

      • DragScrollListener

        public DragScrollListener​(ScrollPane scroll)
    • Method Detail

      • setup

        public void setup​(float minSpeedPixels,
                          float maxSpeedPixels,
                          float tickSecs,
                          float rampSecs)
      • isAbove

        protected boolean isAbove​(float y)
      • isBelow

        protected boolean isBelow​(float y)
      • scroll

        protected void scroll​(float y)
      • setPadding

        public void setPadding​(float padTop,
                               float padBottom)