Class 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 Classes
    Modifier and Type
    Class
    Description
    static final record 
    A transfer a drag start handler asked for.
  • Constructor Summary

    Constructors
    Constructor
    Description
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    Lets handlers of this event start a transfer.
    org.inspirenxe.strata.api.input.MouseButton
     
    int
     
    float
     
    float
     
    void
    startTransfer(org.inspirenxe.strata.api.transfer.Transfer transfer, Set<org.inspirenxe.strata.api.transfer.DropEffect> allowed)
     
    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)
     
    float
     
    float
     
    Returns the transfer a handler started.

    Methods inherited from class PointerEventImpl

    modifiers, pointerId, pressure, setPointer, x, y

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.inspirenxe.strata.api.event.Cancelable

    cancel, consume, isCancelled, isHandled

    Methods inherited from interface org.inspirenxe.strata.api.event.Event

    cause, current, isPropagationStopped, origin, stopPropagation, target

    Methods inherited from interface org.inspirenxe.strata.api.event.input.PointerEvent

    localX, localY, modifiers, pointerId, pressure, x, y

    Methods 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 on
      x - the pointer's x, in the host's coordinates; the press position for the start event
      y - the pointer's y, in the host's coordinates; the press position for the start event
      modifiers - the modifiers held, or Modifiers.NONE when the engine does not report them
      button - the button that started the drag
      clicks - the click count of the press that started the drag
      startX - the x of that press, in the host's coordinates
      startY - the y of that press, in the host's coordinates
      deltaX - the horizontal movement since the previous event of this drag, 0 for the start event
      deltaY - 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:
      button in interface org.inspirenxe.strata.api.event.input.DragEvent
    • clicks

      public int clicks()
      Specified by:
      clicks in interface org.inspirenxe.strata.api.event.input.DragEvent
    • startX

      public float startX()
      Specified by:
      startX in interface org.inspirenxe.strata.api.event.input.DragEvent
    • startY

      public float startY()
      Specified by:
      startY in interface org.inspirenxe.strata.api.event.input.DragEvent
    • deltaX

      public float deltaX()
      Specified by:
      deltaX in interface org.inspirenxe.strata.api.event.input.DragEvent
    • deltaY

      public float deltaY()
      Specified by:
      deltaY in interface org.inspirenxe.strata.api.event.input.DragEvent
    • allowTransfer

      public DragEventImpl 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:
      startTransfer in interface org.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:
      startTransfer in interface org.inspirenxe.strata.api.event.input.DragEvent
    • transferRequest

      public DragEventImpl.TransferRequest transferRequest()
      Returns the transfer a handler started.
      Returns:
      the request, or null if no handler started one