Class DragHandler

All Implemented Interfaces:
CursorListener

public class DragHandler extends DefaultCursorListener
Work in progress.
  • Constructor Details

    • DragHandler

      public DragHandler()
    • DragHandler

      public DragHandler(Function<Spatial,Spatial> draggableLocator)
  • Method Details

    • setDraggableLocator

      public void setDraggableLocator(Function<Spatial,Spatial> draggableLocator)
      Sets the function that will be used to find the draggable spatial relative to the spatial that was clicked. By default, this is the identity() function and will return the spatial that was clicked.
    • getDraggableLocator

      public Function<Spatial,Spatial> getDraggableLocator()
    • isDragging

      public boolean isDragging()
    • getDragStartLocation

      protected Vector2f getDragStartLocation()
    • findDraggable

      protected Spatial findDraggable(Spatial capture)
      Finds the draggable spatial for the specified capture spatial. By default this just returns the capture because the parentLocator function is the identity function. This can be overridden by specifying a different function or overriding this method.
    • startDrag

      protected void startDrag(CursorButtonEvent event, Spatial target, Spatial capture)
    • endDrag

      protected void endDrag(CursorButtonEvent event, Spatial target, Spatial capture)
    • cursorButtonEvent

      public void cursorButtonEvent(CursorButtonEvent event, Spatial target, Spatial capture)
      Specified by:
      cursorButtonEvent in interface CursorListener
      Overrides:
      cursorButtonEvent in class DefaultCursorListener
    • cursorMoved

      public void cursorMoved(CursorMotionEvent event, Spatial target, Spatial capture)
      Specified by:
      cursorMoved in interface CursorListener
      Overrides:
      cursorMoved in class DefaultCursorListener
    • setConsumeDrags

      public void setConsumeDrags(boolean consumeDrags)
    • getConsumeDrags

      public boolean getConsumeDrags()
    • setConsumeDrops

      public void setConsumeDrops(boolean consumeDrops)
    • getConsumeDrops

      public boolean getConsumeDrops()