com.badlogic.gdx.scenes.scene2d.utils
Class DragAndDrop

java.lang.Object
  extended by com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop

public class DragAndDrop
extends Object

Manages drag and drop operations through registered drag sources and drop targets.

Author:
Nathan Sweet

Nested Class Summary
static class DragAndDrop.Payload
          The payload of a drag and drop operation.
static class DragAndDrop.Source
          A target where a payload can be dragged from.
static class DragAndDrop.Target
          A target where a payload can be dropped to.
 
Constructor Summary
DragAndDrop()
           
 
Method Summary
 void addSource(DragAndDrop.Source source)
           
 void addTarget(DragAndDrop.Target target)
           
 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 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 setTapSquareSize(float halfTapSquareSize)
          Sets the distance a touch must travel before being considered a drag.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DragAndDrop

public DragAndDrop()
Method Detail

addSource

public void addSource(DragAndDrop.Source source)

removeSource

public void removeSource(DragAndDrop.Source source)

addTarget

public void addTarget(DragAndDrop.Target target)

removeTarget

public void removeTarget(DragAndDrop.Target target)

setTapSquareSize

public void setTapSquareSize(float halfTapSquareSize)
Sets the distance a touch must travel before being considered a drag.


setButton

public void setButton(int button)
Sets the button to listen for, all other buttons are ignored. Default is Input.Buttons.LEFT. Use -1 for any button.


setDragActorPosition

public void setDragActorPosition(float dragActorX,
                                 float dragActorY)

isDragging

public boolean isDragging()

getDragActor

public Actor getDragActor()
Returns the current drag actor, or null.


setDragTime

public void setDragTime(int dragMillis)
Time in milliseconds that a drag must take before a drop will be considered valid. This ignores an accidental drag and drop that was meant to be a click. Default is 250.



Copyright © 2013. All Rights Reserved.