Overview Rules and Configuration
Snap Lines are an optional feature which is available if you are in Edit Mode. Snap Lines can be switched on or off either from the menu bar (View >> Snap Lines) or from the tool bar.
Snap Lines help you to interactively create a graph with an appealing layout.
They can be used instead of a layout algorithm or to fine-tune a
layout.
Snap Lines work as follows. While you move the mouse the graph element that you edit snaps to good-looking positions, e.g., a dragged node snaps to positions where its center is aligned with the center of a so-called fixed node (since it does not move) in the graph.
While a graph element is snapped, the reason for the snapping is indicated by displaying snap lines like the line through the aligned centers of the dragged node and the fixed node in the picture above. If you continue to move the node in an approximately horizontal direction in this situation, the center of the dragged node will remain aligned with the center of the fixed node until you move the mouse further away from the snap line. If you drop the node while it is snapped, you can be sure that the centers of the nodes are in fact aligned, even if the mouse was not directly on the snap line.
You can disable Snap Lines temporarily while they are active by pressing the CTRL key.
This is a convenience, if you just want to place a node one pixel beside the currently active
snap line, without switching off snap lines globally and then on again afterwards.
yEd has several rules for determining the candidates for good-looking positions. For example, a node snaps in the middle between two fixed nodes. This is indicated as follows.
Snap Lines also help you when you resize a node. They indicate a common width or height of the resized node with any other node(s) in the graph.
There is a preferred distance for nodes. A node snaps if it is either horizontally or vertically at this distance from another fixed node in the graph.
Multiple Snap Lines
There may be more than one reason why a node is snapped at a certain position. In this
case, a suitable selection of the corresponding snap lines is shown.
In the picture above you can see two snap lines indicating the aligned centers of the dragged node (the selected one) with the two fixed nodes. Note that since the three nodes are of equal size the right and left sides of the dragged node and the topmost node are aligned, too. Moreover, the upper and lower sides of the leftmost node and the dragged node are aligned. This could be visualized by four additional snap lines, but they are not shown since they would clutter up the view.
Snap Lines for other Graph Elements
Snap Lines are not limited to editing nodes. They apply to edges and bends, too. The following
snap shot shows the creation of an orthogonal edge.
The following picture shows snap lines while moving a bend, the lower right bend of the selected edge. Moving the bend while Orthogonal Edges are active, results in moving the adjacent segments of the bend. Both segments are snapped in this situation.
The horizontal segment is snapped because its distance to the other edge is equal to the preferred edge to edge distance. The vertical segment is snapped because its distance to the right side of the upper node is equal to the preferred node to edge distance. The preferred distances for snap lines and other parameters can be configured on the Snap Lines tab in the Preferences dialog (File >> Preferences... >> Snap Lines).
There are three configurable distances which influence the snapping behavior.
The distances and the color of the snap lines can be configured in the Preferences dialog (File >> Preferences... >> Snap Lines).
The following rules govern the snapping behavior of yEd, if snap lines are active.