Class DragScrollListener
- java.lang.Object
-
- com.badlogic.gdx.scenes.scene2d.InputListener
-
- com.badlogic.gdx.scenes.scene2d.utils.DragListener
-
- com.badlogic.gdx.scenes.scene2d.utils.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 haveScrollPane.setCancelTouchFocus(boolean)
false. When a drag starts that should drag rather than flick scroll, cancel the scroll pane's touch focus usingstage.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 Summary
Constructors Constructor Description DragScrollListener(ScrollPane scroll)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
drag(InputEvent event, float x, float y, int pointer)
void
dragStop(InputEvent event, float x, float y, int pointer)
protected boolean
isAbove(float y)
protected boolean
isBelow(float y)
protected void
scroll(float y)
void
setPadding(float padTop, float padBottom)
void
setup(float minSpeedPixels, float maxSpeedPixels, float tickSecs, float rampSecs)
-
Methods inherited from class com.badlogic.gdx.scenes.scene2d.utils.DragListener
cancel, dragStart, getButton, getDeltaX, getDeltaY, getDragDistance, getDragStartX, getDragStartY, getDragX, getDragY, getStageTouchDownX, getStageTouchDownY, getTapSquareSize, getTouchDownX, getTouchDownY, isDragging, setButton, setDragStartX, setDragStartY, setTapSquareSize, touchDown, touchDragged, touchUp
-
Methods inherited from class com.badlogic.gdx.scenes.scene2d.InputListener
enter, exit, handle, keyDown, keyTyped, keyUp, mouseMoved, scrolled
-
-
-
-
Constructor Detail
-
DragScrollListener
public DragScrollListener(ScrollPane scroll)
-
-
Method Detail
-
setup
public void setup(float minSpeedPixels, float maxSpeedPixels, float tickSecs, float rampSecs)
-
drag
public void drag(InputEvent event, float x, float y, int pointer)
- Overrides:
drag
in classDragListener
-
dragStop
public void dragStop(InputEvent event, float x, float y, int pointer)
- Overrides:
dragStop
in classDragListener
-
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)
-
-