mxDragSource

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.

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

Summary
mxDragSourceWrapper 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.
Functions
mxDragSourceConstructs a new drag source for the given element.
Variables
elementReference to the DOM node which was made draggable.
dropHandlerHolds the DOM node that is used to represent the drag preview.
dragOffsetmxPoint that specifies the offset of the dragElement.
dragElementHolds the DOM node that is used to represent the drag preview.
previewElementOptional mxRectangle that specifies the unscaled size of the preview.
enabledSpecifies if this drag source is enabled.
currentGraphReference to the mxGraph that is the current drop target.
currentDropTargetHolds the current drop target under the mouse.
currentPointHolds the current drop location.
currentGuideHolds an mxGuide for the currentGraph if <dragPreview> is not null.
currentGuideHolds an mxGuide for the currentGraph if <dragPreview> is not null.
autoscrollSpecifies if the graph should scroll automatically.
guidesEnabledSpecifies if mxGuide should be enabled.
gridEnabledSpecifies if the grid should be allowed.
highlightDropTargetsSpecifies if drop targets should be highlighted.
Functions
isEnabledReturns enabled.
setEnabledSets enabled.
isGuidesEnabledReturns guidesEnabled.
setGuidesEnabledSets guidesEnabled.
isGridEnabledReturns gridEnabled.
setGridEnabledSets gridEnabled.
getGraphForEventReturns the graph for the given mouse event.
getDropTargetReturns the drop target for the given graph and coordinates.
createDragElementCreates and returns a clone of the <dragElementPrototype> or the element if the former is not defined.
createPreviewElementCreates and returns an element which can be used as a preview in the given graph.
mouseDownReturns the drop target for the given graph and coordinates.
startDragCreates the dragElement using createDragElement.
stopDragRemoves and destroys the dragElement.
graphContainsEventReturns true if the given graph contains the given event.
mouseMoveGets the graph for the given event using getGraphForEvent, updates the currentGraph, calling dragEnter and dragExit on the new and old graph, respectively, and invokes dragOver if currentGraph is not null.
mouseUpProcesses the mouse up event and invokes drop, dragExit and stopDrag as required.
dragEnterActives the given graph as a drop target.
dragExitDeactivates the given graph as a drop target.
dragOverImplements autoscroll, updates the currentPoint, highlights any drop targets and updates the preview.
dropReturns the drop target for the given graph and coordinates.

Functions

mxDragSource

function mxDragSource(element,
dropHandler)

Constructs a new drag source for the given element.

Variables

element

mxDragSource.prototype.element

Reference to the DOM node which was made draggable.

dropHandler

mxDragSource.prototype.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.

dragOffset

mxDragSource.prototype.dragOffset

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

dragElement

mxDragSource.prototype.dragElement

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.

previewElement

mxDragSource.prototype.previewElement

Optional mxRectangle that specifies the unscaled size of the preview.

enabled

mxDragSource.prototype.enabled

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

currentGraph

mxDragSource.prototype.currentGraph

Reference to the mxGraph that is the current drop target.

currentDropTarget

mxDragSource.prototype.currentDropTarget

Holds the current drop target under the mouse.

currentPoint

mxDragSource.prototype.currentPoint

Holds the current drop location.

currentGuide

mxDragSource.prototype.currentGuide

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

currentGuide

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

autoscroll

mxDragSource.prototype.autoscroll

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

guidesEnabled

mxDragSource.prototype.guidesEnabled

Specifies if mxGuide should be enabled.  Default is true.

gridEnabled

mxDragSource.prototype.gridEnabled

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

highlightDropTargets

mxDragSource.prototype.highlightDropTargets

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

Functions

isEnabled

mxDragSource.prototype.isEnabled = function()

Returns enabled.

setEnabled

mxDragSource.prototype.setEnabled = function(value)

Sets enabled.

isGuidesEnabled

mxDragSource.prototype.isGuidesEnabled = function()

Returns guidesEnabled.

setGuidesEnabled

mxDragSource.prototype.setGuidesEnabled = function(value)

Sets guidesEnabled.

isGridEnabled

mxDragSource.prototype.isGridEnabled = function()

Returns gridEnabled.

setGridEnabled

mxDragSource.prototype.setGridEnabled = function(value)

Sets gridEnabled.

getGraphForEvent

mxDragSource.prototype.getGraphForEvent = function(evt)

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

getDropTarget

mxDragSource.prototype.getDropTarget = function(graph,
x,
y)

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

createDragElement

mxDragSource.prototype.createDragElement = function(evt)

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

createPreviewElement

mxDragSource.prototype.createPreviewElement = function(graph)

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

mouseDown

mxDragSource.prototype.mouseDown = function(evt)

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

startDrag

mxDragSource.prototype.startDrag = function(evt)

Creates the dragElement using createDragElement.

stopDrag

mxDragSource.prototype.stopDrag = function(evt)

Removes and destroys the dragElement.

graphContainsEvent

mxDragSource.prototype.graphContainsEvent = function(graph,
evt)

Returns true if the given graph contains the given event.

mouseMove

mxDragSource.prototype.mouseMove = function(evt)

Gets the graph for the given event using getGraphForEvent, updates the currentGraph, calling dragEnter and dragExit on the new and old graph, respectively, and invokes dragOver if currentGraph is not null.

mouseUp

mxDragSource.prototype.mouseUp = function(evt)

Processes the mouse up event and invokes drop, dragExit and stopDrag as required.

dragEnter

mxDragSource.prototype.dragEnter = function(graph)

Actives the given graph as a drop target.

dragExit

mxDragSource.prototype.dragExit = function(graph)

Deactivates the given graph as a drop target.

dragOver

mxDragSource.prototype.dragOver = function(graph,
evt)

Implements autoscroll, updates the currentPoint, highlights any drop targets and updates the preview.

drop

mxDragSource.prototype.drop = function(graph,
evt,
dropTarget,
x,
y)

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

function mxDragSource(element,
dropHandler)
Constructs a new drag source for the given element.
mxDragSource.prototype.element
Reference to the DOM node which was made draggable.
mxDragSource.prototype.dropHandler
Holds the DOM node that is used to represent the drag preview.
mxDragSource.prototype.dragOffset
mxPoint that specifies the offset of the dragElement.
Implements a 2-dimensional vector with double precision coordinates.
mxDragSource.prototype.dragElement
Holds the DOM node that is used to represent the drag preview.
mxDragSource.prototype.previewElement
Optional mxRectangle that specifies the unscaled size of the preview.
Extends mxPoint to implement a 2-dimensional rectangle with double precision coordinates.
mxDragSource.prototype.enabled
Specifies if this drag source is enabled.
mxDragSource.prototype.currentGraph
Reference to the mxGraph that is the current drop target.
Extends mxEventSource to implement a graph component for the browser.
mxDragSource.prototype.currentDropTarget
Holds the current drop target under the mouse.
mxDragSource.prototype.currentPoint
Holds the current drop location.
mxDragSource.prototype.currentGuide
Holds an mxGuide for the currentGraph if dragPreview is not null.
Implements the alignment of selection cells to other cells in the graph.
mxDragSource.prototype.autoscroll
Specifies if the graph should scroll automatically.
mxDragSource.prototype.guidesEnabled
Specifies if mxGuide should be enabled.
mxDragSource.prototype.gridEnabled
Specifies if the grid should be allowed.
mxDragSource.prototype.highlightDropTargets
Specifies if drop targets should be highlighted.
mxDragSource.prototype.isEnabled = function()
Returns enabled.
mxDragSource.prototype.setEnabled = function(value)
Sets enabled.
mxDragSource.prototype.isGuidesEnabled = function()
Returns guidesEnabled.
mxDragSource.prototype.setGuidesEnabled = function(value)
Sets guidesEnabled.
mxDragSource.prototype.isGridEnabled = function()
Returns gridEnabled.
mxDragSource.prototype.setGridEnabled = function(value)
Sets gridEnabled.
mxDragSource.prototype.getGraphForEvent = function(evt)
Returns the graph for the given mouse event.
mxDragSource.prototype.getDropTarget = function(graph,
x,
y)
Returns the drop target for the given graph and coordinates.
mxDragSource.prototype.createDragElement = function(evt)
Creates and returns a clone of the dragElementPrototype or the element if the former is not defined.
mxDragSource.prototype.createPreviewElement = function(graph)
Creates and returns an element which can be used as a preview in the given graph.
mxDragSource.prototype.mouseDown = function(evt)
Returns the drop target for the given graph and coordinates.
mxDragSource.prototype.startDrag = function(evt)
Creates the dragElement using createDragElement.
mxDragSource.prototype.stopDrag = function(evt)
Removes and destroys the dragElement.
mxDragSource.prototype.graphContainsEvent = function(graph,
evt)
Returns true if the given graph contains the given event.
mxDragSource.prototype.mouseMove = function(evt)
Gets the graph for the given event using getGraphForEvent, updates the currentGraph, calling dragEnter and dragExit on the new and old graph, respectively, and invokes dragOver if currentGraph is not null.
mxDragSource.prototype.dragEnter = function(graph)
Actives the given graph as a drop target.
mxDragSource.prototype.dragExit = function(graph)
Deactivates the given graph as a drop target.
mxDragSource.prototype.dragOver = function(graph,
evt)
Implements autoscroll, updates the currentPoint, highlights any drop targets and updates the preview.
mxDragSource.prototype.mouseUp = function(evt)
Processes the mouse up event and invokes drop, dragExit and stopDrag as required.
mxDragSource.prototype.drop = function(graph,
evt,
dropTarget,
x,
y)
Returns the drop target for the given graph and coordinates.
mxGraph.prototype.getCellAt = function(x,
y,
parent,
vertices,
edges)
Returns the bottom-most cell that intersects the given point (x, y) in the cell hierarchy starting at the given parent.
Close