Class DragSource

DragSource

Wrapper to create a drag source from a DOM element so that the element can be dragged over a graph and dropped into the graph as a new cell.

Problem is that in the dropHandler the current preview location is not available, so the preview and the dropHandler must match.

Constructors

Properties

autoscroll: boolean = true

Specifies if the graph should scroll automatically. Default is true.

checkEventSource: boolean = true

Whether the event source should be checked in graphContainerEvent. Default is true.

currentDropTarget: null | Cell = null

Holds the current drop target under the mouse.

currentGraph: null | Graph = null

Reference to the mxGraph that is the current drop target.

currentGuide: null | Guide = null

Holds an mxGuide for the currentGraph if dragPreview is not null.

currentHighlight: null | CellHighlight = null

Holds an mxGuide for the currentGraph if dragPreview is not null.

wrong doc

currentPoint: null | Point = null

Holds the current drop location.

dragElement: null | HTMLElement = null

Holds the DOM node that is used to represent the drag preview. If this is null then the source element will be cloned and used for the drag preview.

dragElementOpacity: number = 70

Opacity of the drag element in %. Default is 70.

dragElementZIndex: number = 100

ZIndex for the drag element. Default is 100.

dragOffset: null | Point = null

Point that specifies the offset of the dragElement. Default is null.

dropHandler: DropHandler

Holds the DOM node that is used to represent the drag preview. If this is null then the source element will be cloned and used for the drag preview.

element: EventTarget

Reference to the DOM node which was made draggable.

enabled: boolean = true

Specifies if this drag source is enabled. Default is true.

eventConsumer: ((sender: EventSource, evt: EventObject) => void)
eventSource: null | EventTarget = null
gridEnabled: boolean = true

Specifies if the grid should be allowed. Default is true.

guidesEnabled: boolean = true

Specifies if mxGuide should be enabled. Default is true.

highlightDropTargets: boolean = true

Specifies if drop targets should be highlighted. Default is true.

mouseMoveHandler: null | ((evt: MouseEvent) => void) = null
mouseUpHandler: null | ((evt: MouseEvent) => void) = null
previewElement: null | HTMLElement = null

TODO - wrong description Optional Rectangle that specifies the unscaled size of the preview.

previewOffset: null | Point = null

Optional Point that specifies the offset of the preview in pixels.

Methods

  • Creates and returns a clone of the dragElementPrototype or the element if the former is not defined.

    Parameters

    • evt: MouseEvent

    Returns HTMLElement

  • Creates and returns an element which can be used as a preview in the given graph.

    Parameters

    Returns null | HTMLElement

  • Deactivates the given graph as a drop target.

    Parameters

    • graph: Graph
    • Optionalevt: MouseEvent

    Returns void

  • Returns the drop target for the given graph and coordinates. This implementation uses mxGraph.getCellAt.

    Parameters

    • graph: Graph
    • evt: MouseEvent
    • dropTarget: null | Cell = null
    • x: number
    • y: number

    Returns void

  • Returns the drop target for the given graph and coordinates. This implementation uses mxGraph.getCellAt.

    Parameters

    • graph: Graph
    • x: number
    • y: number
    • evt: MouseEvent

    Returns null | Cell

  • Returns the topmost element under the given event.

    Parameters

    • evt: MouseEvent

    Returns null | EventTarget

  • Returns the graph for the given mouse event. This implementation returns null.

    Parameters

    • evt: MouseEvent

    Returns null

  • Returns true if the given graph contains the given event.

    Parameters

    • graph: Graph
    • evt: MouseEvent

    Returns boolean

  • Returns the drop target for the given graph and coordinates. This implementation uses mxGraph.getCellAt.

    To ignore popup menu events for a drag source, this function can be overridden as follows.

    Parameters

    • evt: MouseEvent

    Returns void

    var mouseDown = dragSource.mouseDown;

    dragSource.mouseDown(evt)
    {
    if (!mxEvent.isPopupTrigger(evt))
    {
    mouseDown.apply(this, arguments);
    }
    };