Package com.simsilica.lemur.event
Class DragHandler
java.lang.Object
com.simsilica.lemur.event.DefaultCursorListener
com.simsilica.lemur.event.DragHandler
- All Implemented Interfaces:
CursorListener
Work in progress.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
cursorButtonEvent
(CursorButtonEvent event, Spatial target, Spatial capture) void
cursorMoved
(CursorMotionEvent event, Spatial target, Spatial capture) protected void
endDrag
(CursorButtonEvent event, Spatial target, Spatial capture) protected Spatial
findDraggable
(Spatial capture) Finds the draggable spatial for the specified capture spatial.boolean
boolean
protected Vector2f
boolean
void
setConsumeDrags
(boolean consumeDrags) void
setConsumeDrops
(boolean consumeDrops) 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.protected void
startDrag
(CursorButtonEvent event, Spatial target, Spatial capture) Methods inherited from class com.simsilica.lemur.event.DefaultCursorListener
click, cursorEntered, cursorExited
-
Constructor Details
-
DragHandler
public DragHandler() -
DragHandler
-
-
Method Details
-
setDraggableLocator
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
-
isDragging
public boolean isDragging() -
getDragStartLocation
-
findDraggable
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
-
endDrag
-
cursorButtonEvent
- Specified by:
cursorButtonEvent
in interfaceCursorListener
- Overrides:
cursorButtonEvent
in classDefaultCursorListener
-
cursorMoved
- Specified by:
cursorMoved
in interfaceCursorListener
- Overrides:
cursorMoved
in classDefaultCursorListener
-
setConsumeDrags
public void setConsumeDrags(boolean consumeDrags) -
getConsumeDrags
public boolean getConsumeDrags() -
setConsumeDrops
public void setConsumeDrops(boolean consumeDrops) -
getConsumeDrops
public boolean getConsumeDrops()
-