The Edit Mode supports creation of a graph and its elements and allows all kinds of modifications to them. yEd also provides a Navigation Mode. Either of these modes can be activated from the tool bar and the menu bar. When yEd starts up, it is in Edit Mode by default.
Extensions
There are three optional features which have an influence on how the Edit Mode works: Snap Lines, Grid and Orthogonal Edges. They can be switched on or off from the tool bar and the menu bar. The following describes the behavior of the edit mode, if these additional features are switched off.
Working with the Edit Mode
This mode allows for creating and/or manipulating a graph that is shown in the editor. The following actions can be performed by using the mouse or the keyboard:
- Creating a new node
-
A node can be created by dragging any of the sample node representations from the Palette tool window into the active editor window (using a mouse drag gesture).
Image nodes can also be created by dragging an image file from the file system onto the active editor. The new node is created at the drop location.
Additionally, it is possible to create a node by a simple mouse click (left mouse button) within the active editor window if option
Create Node on Background Click is enabled. A new default node will appear at that spot. The mouse click must occur at an empty place within the drawing canvas. If there are selected graph elements, then no node will be created but the graph elements are deselected instead.
See also: Create a new group node, Add/Remove a node to a group node/from a group node - Selecting and deselecting nodes
-
Click on a node to select it. A selected node will have a different appearance than an unselected one. Click on any location in the editor not occupied by a node to deselect all nodes.
By left-dragging the mouse, starting from an unoccupied location in the editor, a selection box will open up.
By dragging the mouse around one can change the bounds of the box. Releasing the mouse button will select all nodes that lie within the selection box. All objects outside the box will be deselected.
Opening up a selection box with the SHIFT key held down adds the selection box nodes to the set of previously selected nodes.
Clicking on a node with the SHIFT key held down selects the node, if it was not already selected. If it was already selected it is deselected. The selection state of all other nodes remains as it was.
See also: Selecting group nodes, Selecting covered elements and internal node labels - Creating a new edge
-
Start left-dragging the mouse from an unselected start node. Then release the mouse button over an end node.
If the mouse is not released over a node, a control point (also called bend) for the new edge will be inserted at that release location. More bends can be created by clicking with the left mouse button on an unoccupied location. By left-clicking on an end node, the edge with additional bends will be created.
By clicking the right mouse button the edge or bend creation will be canceled. Alternatively, use the ESC key to cancel edge creation.
An edge can also be created by dragging a sample edge representation from the Palette tool window onto a node in the active editor window (using a mouse drag gesture).
See also: Create a new edge that connects to a group node, Orthogonal Edges - Selecting and deselecting edges
-
Select an edge by left-clicking on it. Selecting more than one edge requires two steps: first select one edge as described above, then open up a selection box with the SHIFT key held down to add more edges to the selection. To select all edges, first select one edge then trigger the select all action by hitting CTRL-A [Mac OS: Command-A].
To deselect all edges click on an unoccupied location in the editor. - Moving nodes
- Select the nodes that you want to move around. Then press the left mouse button over one of the selected nodes and start dragging the mouse. The selected nodes will now move along with the mouse cursor. The nodes will stop moving when the mouse button is released.
See also: Add/Remove a node to a group node/from a group node, Orthogonal Edges, Snap Lines - Creating bends
-
Start left-dragging the mouse on an edge. This will insert a new bend on that edge at the pressed location and moves the bend along with the mouse cursor.
See also: Orthogonal Edges, Snap Lines - Selecting and deselecting bends
-
Bends are selected the same way as nodes. Either click on a bend or select multiple bends by opening up a selection box with or without the SHIFT key held down.
To deselect all bends click on an unoccupied location in the editor. - Moving bends
-
First select the bends that you want to move. Then start left-dragging the mouse on one of the selected bends. This will move all selected bends along with the mouse cursor. Releasing the mouse button again stops moving bends.
See also: Orthogonal Edges, Snap Lines - Context-sensitive menus
-
Click the right mouse button to bring up a context-sensitive menu for elements in the editor window. The context is determined by the selection state of the elements and the location where you click the mouse.
If you right-click on a specific object, a context menu for that object pops up. If more than one object is selected, then the context menu refers to the selection as a whole if you activate it by right-clicking on an unoccupied location in the editor. Otherwise, the context menu will be specific for the element that you have clicked on. - Deleting elements
- Select the elements you want to delete. Then press the DELETE key or open the context-sensitive menu with a right mouse click and then select Delete.
- Creating labels
- Activate the context-sensitive menu for the node or edge that needs a new label. Select Add Label from that menu. This will add the label at a default location with a dummy text.
- Selecting and deselecting labels
-
Labels are selected by clicking on the label text.
To deselect a label click on an unoccupied location in the editor. - Editing label text
-
The label editor can be activated by double-clicking a label or via the context-sensitive menu. To edit a node label right-click on the node to bring up the menu. To edit an edge label right-click on that label to bring up the menu. From the context-sensitive menu choose Edit Label. Alternatively, press F2 [Mac OS: ENTER] to edit the label of a selected item. An inlined text editor will appear at the label position that allows you to enter another text. To close the label editor either click on a location outside of the text editor bounds or hit ENTER. To add a new line to the label text use CTRL-ENTER.
If you want to create several multi-line labels you can swap the keys for leaving the editor and creating new lines. This is possible by using the option File >> Preferences… >> Editor >> Label Editor.
Note that label text that starts with ‘<html>
‘ is automatically interpreted as HTML markup. This enables using (simple) HTML content to create labels.
yEd is able to wrap long labels automatically. For the details follow the link below.
See also: Properties of Nodes and Edges - Moving labels
-
A label can be moved to another position by pressing the left mouse button on it and then by dragging the label around. While dragging so-called label candidate boxes will appear. These boxes mark the positions that are available for the label. The set of available label positions depends on the label model that is associated which the label.
When the mouse button gets released, the label will automatically snap to the closest available label position.
The section Selecting covered elements and internal node labels describes how to select node labels which are located completely inside a node. After selecting such a label it can be moved as described above. - Moving edge ports
-
Edge ports are the logical end points of a visual edge path. The ports of an edge are highlighted as little black squares whenever the
edge is selected.
A port of a selected edge can be moved to another position by pressing the left mouse button over it and then by dragging the port around. The action is terminated when the mouse button is released.
Additionally, if the SHIFT key is pressed while dragging the port so-called port candidate boxes will appear. These boxes mark the positions that are available for the port in this mode. The port will then automatically snap to the closest available port position when the mouse button is released.
By moving its edge ports, it is easily possible to disconnect an edge from its original end nodes and reconnect it to other end nodes. The node to which a moved port will be assigned is visually indicated. - Selecting covered elements and internal node labels
-
If elements of the graph overlap it can get difficult to select the covered elements. A label which lies completely inside a node cannot be selected at all by just clicking on it. In such cases clicking while pressing the control key (CTRL) [Mac OS: option key (Alt)]
cyclically selects the elements at the mouse position one after the other and draws them on top together with their dependent elements.
Edit Mode also provides a number of actions that are related to grouped and nested graph hierarchies (for more thorough information on this topic, see “Grouped and Nested Graph Hierarchy”):
- Creating a new group node
- A group node can be created by means of the Group operation available in the default context-sensitive menu. When there are selected nodes, the subgraph induced by these nodes will be used as the content for the new group node. When there are no nodes selected, then the new group node will be empty.
- Adding a node to a group node/Removing a node from a group node
-
A node can be added to the content of a group node by holding down the SHIFT key while moving it into the group node. To remove a node from the contents of a group node move it out of the group node while holding down the SHIFT key.
Note: By moving the corresponding item within the tree view, a node can be added to, respectively removed from the contents of a group node also. (See also: The ‘Structure View’ Tool Window) - Selecting group nodes
- Click on the group node’s label or on the border of the group node to select it. When opening up a selection box, group nodes have to be entirely inside the selection box to get selected.
- Creating a new edge that connects to a group node
- Basically the same procedure as with normal edge creation. However, the left-drag must start/end on the group node’s label or on the border of the group node.
- Viewing the content of a group node
- Double-clicking on a group node will show the group node’s content in the editor window. To return to the previous view, i.e., the hierarchy level that was shown before the double-click, use the Previous View action from the yEd menu bar.
Edit Mode also provides a possibility to move the viewport without switching to Navigation Mode or using the Overview.
- Moving the viewport (Panning)
- The current viewport (the visible diagram area) of the editor window can be changed by right-dragging the mouse around. The viewport will follow the mouse.