Manual

Main API Drag and Drop Commands

# API Drag and Drop Commands

For background information about the commands described on this page, refer to the information about the drag and drop mode in the corresponding section of the API reference.

On this page, API commands of the drag and drop category are described. This category covers all commands to implement user interaction with drag and drop available for an application. The commands of this category are enclosed by keyword "drag_and_drop(...)". Click here to get an overview of all API commands.

## drag_and_drop(dragging_on)

To enable the drag and drop mode for accessing functions of the application by using direct manipulation interactions in a uDraw(Graph) graph visualization. Afterwards the 2-D scrolling that can usually be accessed with the middle mouse button is no longer available. After sending this command, the application has to be prepared for the following API answers used to inform about drag and drop operations:

- create_node(...)
- create_node_and_edge(...)
- create_edge(...)
- drop_node(...)

## drag_and_drop(dragging_off)

To disable the drag and drop mode, so 2-D scrolling is available again.

## drag_and_drop(new_node_at_coord(node_update))

This command is the recommended action after receiving the API answer create_node(...), see information about the drag and drop mode. When the API has sent this answer, the coordinates where the mouse button was released are stored internally and used as the preferred position of the next node that will be inserted with this command. Therefore only a single node can be used in the parameter. uDraw(Graph) tries to insert the new node at the stored coordinate, but this may not be (completely) possible due to layout restrictions, see graph layout concepts. Without a previous create_node(...), create_node_and_edge(...) or drop_node(...) answer, no coordinate is available and the command behaves like an usual graph update with command graph(update(...)).

## drag_and_drop(new_edge_and_node_at_coord(node_update,edge_update))

This command is the recommended action after receiving the API answer create_node_and_edge(...), see information about the drag and drop mode. All information about parameter "node_update" in command drag_and_drop(new_node_at_coord(...)) is applicable here, too. The additional "edge_update" has to be used to insert a new edge where the parent is the start node of the drag and drop operation (reported to the application by answer create_node_and_edge(...)) and the child is the new node created here in parameter "node_update".