Class DefaultDraggable

java.lang.Object
com.simsilica.lemur.dnd.DefaultDraggable
All Implemented Interfaces:
Draggable

public class DefaultDraggable extends Object implements Draggable
A default draggable implementation that will simply move a spatial in a particular plane based on a starting location and an x/y delta.
  • Constructor Details

    • DefaultDraggable

      public DefaultDraggable(Vector2f start, Spatial spatial, Vector3f origin, Vector3f xAxis, Vector3f yAxis)
      Creates a DefaultDraggable that will set the location of the spatial in 3D space relative to the specified origin.
    • DefaultDraggable

      public DefaultDraggable(ViewPort view, Spatial spatial, Vector2f start)
      Creates a 3D draggable that will move the specified spatial relative to its current translation in a plane relative to the current viewport camera.
  • Method Details

    • getSpatial

      public Spatial getSpatial()
    • updateTranslation

      protected void updateTranslation()
    • setLocation

      public void setLocation(float x, float y)
      Description copied from interface: Draggable
      Called by the drag session to update the position of the draggable in camera/viewport space.
      Specified by:
      setLocation in interface Draggable
    • getLocation

      public Vector2f getLocation()
      Description copied from interface: Draggable
      Returns the current location of the draggable in camera/viewport space.
      Specified by:
      getLocation in interface Draggable
    • updateDragStatus

      public void updateDragStatus(DragStatus status)
      Description copied from interface: Draggable
      Called by the drag session to update the drag status.
      Specified by:
      updateDragStatus in interface Draggable
    • release

      public void release()
      Description copied from interface: Draggable
      Called when the drag session is done and the Draggable can clean up any of its internal stuff.
      Specified by:
      release in interface Draggable