public class DragAndDrop extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DragAndDrop.Payload
The payload of a drag and drop operation.
|
static class |
DragAndDrop.Source
A source where a payload can be dragged from.
|
static class |
DragAndDrop.Target
A target where a payload can be dropped to.
|
Constructor and Description |
---|
DragAndDrop() |
Modifier and Type | Method and Description |
---|---|
void |
addSource(DragAndDrop.Source source) |
void |
addTarget(DragAndDrop.Target target) |
void |
clear()
Removes all targets and sources.
|
Actor |
getDragActor()
Returns the current drag actor, or null.
|
boolean |
isDragging() |
void |
removeSource(DragAndDrop.Source source) |
void |
removeTarget(DragAndDrop.Target target) |
void |
setButton(int button)
Sets the button to listen for, all other buttons are ignored.
|
void |
setCancelTouchFocus(boolean cancelTouchFocus)
When true (default), the
Stage.cancelTouchFocus() touch focus} is cancelled if
dragStart returns non-null. |
void |
setDragActorPosition(float dragActorX,
float dragActorY) |
void |
setDragTime(int dragMillis)
Time in milliseconds that a drag must take before a drop will be considered valid.
|
void |
setKeepWithinStage(boolean keepWithinStage) |
void |
setTapSquareSize(float halfTapSquareSize)
Sets the distance a touch must travel before being considered a drag.
|
void |
setTouchOffset(float touchOffsetX,
float touchOffsetY)
Sets an offset in stage coordinates from the touch position which is used to determine the drop location.
|
public void addSource(DragAndDrop.Source source)
public void removeSource(DragAndDrop.Source source)
public void addTarget(DragAndDrop.Target target)
public void removeTarget(DragAndDrop.Target target)
public void clear()
public void setTapSquareSize(float halfTapSquareSize)
public void setButton(int button)
Input.Buttons.LEFT
. Use -1 for any button.public void setDragActorPosition(float dragActorX, float dragActorY)
public void setTouchOffset(float touchOffsetX, float touchOffsetY)
public boolean isDragging()
public Actor getDragActor()
public void setDragTime(int dragMillis)
public void setCancelTouchFocus(boolean cancelTouchFocus)
Stage.cancelTouchFocus()
touch focus} is cancelled if
dragStart
returns non-null. This ensures the DragAndDrop is the only
touch focus listener, eg when the source is inside a ScrollPane
with flick scroll enabled.public void setKeepWithinStage(boolean keepWithinStage)
Copyright © 2017. All rights reserved.