@sovereignbase/dragonwatch
    Preparing search index...

    Class DragTarget

    Coordinates pointer dragging from one DOM element into one or more targets.

    DragTarget commits at most once. A committed drag either appends the dragged element to the target or replaces the target, depending on action.

    Index

    Constructors

    • Creates a drag target interaction.

      Parameters

      • dragged: HTMLElement

        The element users can drag.

      • targets: HTMLElement | Iterable<HTMLElement, any, any>

        One target element, or an iterable of target elements.

      • action: DragTargetAction

        The DOM operation to perform when a target accepts the drag.

      • animationDuration: number = 200

        The duration of generated animations, in milliseconds.

      Returns DragTarget

    Properties

    dragged: HTMLElement

    The element users can drag.

    targets: readonly HTMLElement[]

    The target elements that can accept the dragged element.

    Methods

    • Appends an event listener for events whose type is type.

      Type Parameters

      Parameters

      • type: K

        The drag target event type to listen for.

      • listener: DragTargetEventListenerFor<K> | null

        The callback or event listener object that receives the event.

      • Optionaloptions: boolean | AddEventListenerOptions

        Options that control listener registration.

      Returns void

    • Returns the first target with the given element id.

      Parameters

      • id: string

        The element id to match.

      Returns HTMLElement | undefined

      The matching target, or undefined if no target matches.