Class DragEventImpl
java.lang.Object
org.inspirenxe.strata.core.event.EventImpl
org.inspirenxe.strata.core.event.PointerEventImpl
org.inspirenxe.strata.core.event.DragEventImpl
- All Implemented Interfaces:
org.inspirenxe.strata.api.event.Cancelable, org.inspirenxe.strata.api.event.Event, org.inspirenxe.strata.api.event.input.DragEvent, org.inspirenxe.strata.api.event.input.PointerEvent, org.inspirenxe.strata.api.event.SnapshotEvent
public final class DragEventImpl
extends PointerEventImpl
implements org.inspirenxe.strata.api.event.input.DragEvent
The core
DragEvent. The host sends one when a drag starts, one for each pointer move during it, and one
when the button that started it is released. All of them go to the component the button was pressed on.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA transfer a drag start handler asked for. -
Constructor Summary
ConstructorsConstructorDescriptionDragEventImpl(org.inspirenxe.strata.api.component.Component<?> target, float x, float y, org.inspirenxe.strata.api.input.Modifiers modifiers, org.inspirenxe.strata.api.input.MouseButton button, int clicks, float startX, float startY, float deltaX, float deltaY) Creates the event. -
Method Summary
Modifier and TypeMethodDescriptionLets handlers of this event start a transfer.org.inspirenxe.strata.api.input.MouseButtonbutton()intclicks()floatdeltaX()floatdeltaY()voidstartTransfer(org.inspirenxe.strata.api.transfer.Transfer transfer, Set<org.inspirenxe.strata.api.transfer.DropEffect> allowed) voidstartTransfer(org.inspirenxe.strata.api.transfer.Transfer transfer, Set<org.inspirenxe.strata.api.transfer.DropEffect> allowed, Function<org.inspirenxe.strata.api.ComponentFactory, ? extends org.inspirenxe.strata.api.component.Component<?>> image) floatstartX()floatstartY()Returns the transfer a handler started.Methods inherited from class PointerEventImpl
modifiers, pointerId, pressure, setPointer, x, yMethods inherited from class EventImpl
cancel, cause, current, isCancelled, isPropagationStopped, origin, reset, setCauses, snapshotOf, stopPropagation, targetMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.inspirenxe.strata.api.event.Cancelable
cancel, consume, isCancelled, isHandledMethods inherited from interface org.inspirenxe.strata.api.event.Event
cause, current, isPropagationStopped, origin, stopPropagation, targetMethods inherited from interface org.inspirenxe.strata.api.event.input.PointerEvent
localX, localY, modifiers, pointerId, pressure, x, yMethods inherited from interface org.inspirenxe.strata.api.event.SnapshotEvent
currentSnapshot, snapshot, snapshotOf
-
Constructor Details
-
DragEventImpl
public DragEventImpl(org.inspirenxe.strata.api.component.Component<?> target, float x, float y, org.inspirenxe.strata.api.input.Modifiers modifiers, org.inspirenxe.strata.api.input.MouseButton button, int clicks, float startX, float startY, float deltaX, float deltaY) Creates the event.- Parameters:
target- the component the button was pressed onx- the pointer's x, in the host's coordinates; the press position for the start eventy- the pointer's y, in the host's coordinates; the press position for the start eventmodifiers- the modifiers held, orModifiers.NONEwhen the engine does not report thembutton- the button that started the dragclicks- the click count of the press that started the dragstartX- the x of that press, in the host's coordinatesstartY- the y of that press, in the host's coordinatesdeltaX- the horizontal movement since the previous event of this drag, 0 for the start eventdeltaY- the vertical movement since the previous event of this drag, 0 for the start event
-
-
Method Details
-
button
public org.inspirenxe.strata.api.input.MouseButton button()- Specified by:
buttonin interfaceorg.inspirenxe.strata.api.event.input.DragEvent
-
clicks
public int clicks()- Specified by:
clicksin interfaceorg.inspirenxe.strata.api.event.input.DragEvent
-
startX
public float startX()- Specified by:
startXin interfaceorg.inspirenxe.strata.api.event.input.DragEvent
-
startY
public float startY()- Specified by:
startYin interfaceorg.inspirenxe.strata.api.event.input.DragEvent
-
deltaX
public float deltaX()- Specified by:
deltaXin interfaceorg.inspirenxe.strata.api.event.input.DragEvent
-
deltaY
public float deltaY()- Specified by:
deltaYin interfaceorg.inspirenxe.strata.api.event.input.DragEvent
-
allowTransfer
Lets handlers of this event start a transfer. The root calls it on a drag start event while no other drag of its host carries a transfer.- Returns:
- this event
-
startTransfer
public void startTransfer(org.inspirenxe.strata.api.transfer.Transfer transfer, Set<org.inspirenxe.strata.api.transfer.DropEffect> allowed) - Specified by:
startTransferin interfaceorg.inspirenxe.strata.api.event.input.DragEvent
-
startTransfer
public void startTransfer(org.inspirenxe.strata.api.transfer.Transfer transfer, Set<org.inspirenxe.strata.api.transfer.DropEffect> allowed, Function<org.inspirenxe.strata.api.ComponentFactory, ? extends org.inspirenxe.strata.api.component.Component<?>> image) - Specified by:
startTransferin interfaceorg.inspirenxe.strata.api.event.input.DragEvent
-
transferRequest
Returns the transfer a handler started.- Returns:
- the request, or
nullif no handler started one
-