APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.scenes.scene2d.utils

public Class DragScrollListener

extends DragListener
Class Inheritance
Imports
com.badlogic.gdx.math.Interpolation, .Vector2, com.badlogic.gdx.scenes.scene2d.InputEvent, com.badlogic.gdx.scenes.scene2d.ui.ScrollPane, com.badlogic.gdx.utils.Timer, .Timer.Task

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.

Author
Nathan Sweet

Field Summary

Modifier and TypeField and Description
pack-priv Interpolation
pack-priv float
pack-priv float
pack-priv float
pack-priv float
pack-priv long
private ScrollPane
private Timer.Task
private Timer.Task
pack-priv long
pack-priv float
pack-priv static final Vector2

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
drag(InputEvent event, float x, float y, int pointer)

Overrides com.badlogic.gdx.scenes.scene2d.utils.DragListener.drag.

public void
pack-priv float
protected boolean
isAbove(float y)

protected boolean
isBelow(float y)

protected void
scroll(float y)

public void
setPadding(float padTop, float padBottom)

public void
setup(float minSpeedPixels, float maxSpeedPixels, float tickSecs, float rampSecs)

Inherited from com.badlogic.gdx.scenes.scene2d.utils.DragListener:
canceldragStartgetButtongetDeltaXgetDeltaYgetDragDistancegetDragStartXgetDragStartYgetDragXgetDragYgetStageTouchDownXgetStageTouchDownYgetTapSquareSizegetTouchDownXgetTouchDownYisDraggingsetButtonsetDragStartXsetDragStartYsetTapSquareSizetouchDowntouchDraggedtouchUp

Field Detail

interpolationback to summary
pack-priv Interpolation interpolation
maxSpeedback to summary
pack-priv float maxSpeed
minSpeedback to summary
pack-priv float minSpeed
padBottomback to summary
pack-priv float padBottom
padTopback to summary
pack-priv float padTop
rampTimeback to summary
pack-priv long rampTime
scrollback to summary
private ScrollPane scroll
scrollDownback to summary
private Timer.Task scrollDown
scrollUpback to summary
private Timer.Task scrollUp
startTimeback to summary
pack-priv long startTime
tickSecsback to summary
pack-priv float tickSecs
tmpCoordsback to summary
pack-priv static final Vector2 tmpCoords

Hides com.badlogic.gdx.scenes.scene2d.InputListener.tmpCoords.

Constructor Detail

DragScrollListenerback to summary
public DragScrollListener(final ScrollPane scroll)

Method Detail

dragback to summary
public void drag(InputEvent event, float x, float y, int pointer)

Overrides com.badlogic.gdx.scenes.scene2d.utils.DragListener.drag.

dragStopback to summary
public void dragStop(InputEvent event, float x, float y, int pointer)

Overrides com.badlogic.gdx.scenes.scene2d.utils.DragListener.dragStop.

getScrollPixelsback to summary
pack-priv float getScrollPixels()
isAboveback to summary
protected boolean isAbove(float y)
isBelowback to summary
protected boolean isBelow(float y)
scrollback to summary
protected void scroll(float y)
setPaddingback to summary
public void setPadding(float padTop, float padBottom)
setupback to summary
public void setup(float minSpeedPixels, float maxSpeedPixels, float tickSecs, float rampSecs)