The DraggingTool is used to move or copy selected parts with the mouse. Dragging the selection moves parts for which Part#canMove is true. If the user holds down the Control key, this tool will make a copy of the parts being dragged, for those parts for which Part#canCopy is true.
You do not normally need to create an instance of this tool because one already exists as the ToolManager#draggingTool, which you can modify.
Gets the collection of Parts that this tool has copied.
Gets or sets whether for a copying operation the extended selection is copied or only the selected parts.
Gets the Part found at the mouse point.
On touch gestures only, this property gets or sets the time in milliseconds for which the mouse must be stationary before this tool can be started.
Gets the Diagram that owns this tool and for which this tool is handling input events.
Gets the collection of Parts being dragged.
Gets or sets whether moving or copying a node also includes all of the node's tree children and their descendants, along with the links to those additional nodes.
Gets or sets the size of the grid cell used when snapping during a drag if the value of #isGridSnapEnabled is true.
Gets or sets the Spot that specifies what point in the grid cell dragged parts snap to, if the value of #isGridSnapEnabled is true.
Gets or sets the snapping grid's origin point, in document coordinates, if the value of #isGridSnapEnabled is true.
Gets or sets whether this tool is started and is actively doing something.
Gets or sets whether this tool can be started by a mouse event.
Gets or sets whether the DraggingTool snaps objects to grid points.
Gets or sets whether the DraggingTool snaps objects to grid points during the drag.
Gets or sets the name of this tool.
Gets or sets the name of the transaction to be committed by #stopTransaction; if null, the transaction will be rolled back.
This tool can run if the diagram allows selection and moves/copies/dragging-out, if the mouse has moved far enough away to be a drag and not a click, and if #findDraggablePart has found a selectable part at the mouse-down point.
boolean
This is called to cancel any running "WaitAfter" timer.
any
Find the actual collection of nodes and links to be moved or copied, given an initial collection.
A Set or List of Parts.
This method computes the new location for a Node or simple Part, given a new desired location and an optional Map of dragged parts, taking any grid-snapping into consideration, any Part#dragComputation function, and any Part#minLocation and Part#maxLocation.
an optional Map mapping Parts to JavaScript Objects that have a "point" property remembering the original location of that Part.
an optional Point that is modified and returned
Start the dragging operation.
any
Abort any dragging operation.
any
Stop the dragging operation by stopping the transaction and cleaning up any temporary state.
any
Perform any additional side-effects during a drag, whether an internal move or copy or an external drag, that may affect the existing non-moved object(s).
a Point in document coordinates.
the GraphObject at the point, excluding what is being dragged or temporary objects; the argument may be null if the drag is occurring in the background of the diagram. Use GraphObject#part to get the Node or Part at the root of the visual tree of the stationary object.
any
Perform any additional side-effects after a drop, whether an internal move or copy or an external drop, that may affect the existing non-moved object(s).
a Point in document coordinates.
the GraphObject where the drop occurred, excluding what was dropped or temporary objects; the argument may be null if the drop occurred in the background of the diagram. Use GraphObject#part to get the Node or Part at the root of the visual tree of the stationary object.
any
Handle switching between copying and moving modes as the Control key is pressed or released.
any
Handle switching between copying and moving modes as the Control key is pressed or released.
any
The diagram will call this method upon a mouse down event.
any
Move the #draggedParts (or if copying, the #copiedParts) to follow the current mouse point.
any
On a mouse-up finish moving or copying the effective selection.
any
The diagram will call this method as the mouse wheel is rotated.
any
This method is called by the diagram when this tool becomes the current tool; you should not call this method.
any
This method is called by the diagram when this tool stops being the current tool; you should not call this method.
any
This is called a certain delay after a call to #standardWaitAfter if there has not been any call to #cancelWaitAfter.
any
Return the selectable and movable/copyable Part at the mouse-down point.
This convenience function finds the front-most GraphObject that is at a given point and that is part of an Adornment that is of a given category.
a Point in document coordinates.
the required Part#category of the Adornment.
Return true when the last mouse point is far enough away from the first mouse down point to constitute a drag operation instead of just a potential click.
Point in view coordinates, defaults to Diagram#firstInput's InputEvent#viewPoint.
Point in view coordinates, defaults to Diagram#lastInput's InputEvent#viewPoint.
boolean
This predicate is true when the diagram allows objects to be copied and inserted, and some object in the selection is copyable, and the user is holding down the Control key.
boolean
This predicate is true when the diagram allows objects to be moved, and some object in the selection is movable.
boolean
Move a collection of Parts by a given offset.
a Map mapping Parts to JavaScript Objects that have a "point" property remembering the original location of that Part.
Whether to check Part#canMove on each part.
any
Implement the standard behavior for mouse clicks, searching for and calling click handler functions on GraphObjects or on Diagram, and raising the corresponding DiagramEvent.
An optional custom navigation function to find target objects.
An optional custom predicate
any
Implement the standard behavior for mouse enter, over, and leave events, where the mouse is moving but no button is pressed.
any
This override prevents the Control modifier unselecting an already selected part.
any
Implement the standard behavior for mouse wheel events.
any
This is called to start a new timer to call #doWaitAfter after a given delay.
in milliseconds
any
Call Diagram#startTransaction with the given transaction name.
a description of the transaction
boolean
If the Diagram#currentTool is this tool, stop this tool and start the Diagram#defaultTool by making it be the new current tool.
any
If #transactionResult is null, call Diagram#rollbackTransaction, otherwise call Diagram#commitTransaction.
boolean
The diagram asks each tool to update any adornments the tool might use for a given part.
any