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 TypeMethodDescriptionvoidcursorButtonEvent(CursorButtonEvent event, Spatial target, Spatial capture) voidcursorMoved(CursorMotionEvent event, Spatial target, Spatial capture) protected voidendDrag(CursorButtonEvent event, Spatial target, Spatial capture) protected SpatialfindDraggable(Spatial capture) Finds the draggable spatial for the specified capture spatial.booleanbooleanprotected Vector2fbooleanvoidsetConsumeDrags(boolean consumeDrags) voidsetConsumeDrops(boolean consumeDrops) voidsetDraggableLocator(Function<Spatial, Spatial> draggableLocator) Sets the function that will be used to find the draggable spatial relative to the spatial that was clicked.protected voidstartDrag(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:
cursorButtonEventin interfaceCursorListener- Overrides:
cursorButtonEventin classDefaultCursorListener
-
cursorMoved
- Specified by:
cursorMovedin interfaceCursorListener- Overrides:
cursorMovedin classDefaultCursorListener
-
setConsumeDrags
public void setConsumeDrags(boolean consumeDrags) -
getConsumeDrags
public boolean getConsumeDrags() -
setConsumeDrops
public void setConsumeDrops(boolean consumeDrops) -
getConsumeDrops
public boolean getConsumeDrops()
-