Using snapping in Vexlio
Geometric precision with ease

In this introductory post, we'll look at how object "snapping" works in Vexlio and how you can use it for easy precision in your diagrams. We'll see the types of snap points you can use and how to use them effectively. Let's jump in!
The snap points
There are snap points on every object in a Vexlio drawing, even images and text, but the location of the snap points depends on the type of the object. In the image below, we have a rectangle object and three ellipse objects. The snap points on each object are highlighted by the small blue targets:

Geometric snap points shown on several objects.
These snap points occur at various points along the geometry of the object. For example, on a rectangle, there is a snap point at the center, each corner, and the midpoint of each edge. On an ellipse, there is a snap point every 45° along the edge (this is true for non-circular ellipses as well, i.e. ovals).
One important thing to remember is that typically snap points occur along the object’s geometry, which is not necessarily the same as its visual appearance. For example, in the thinner ellipse, its snap points lie exactly in the middle of its black outline. In the thicker width ellipse, Vexlio automatically adds new snap points along its inner and outer visual edges. This only happens when the ellipse is thick enough.
For connectors, snap points typically only occur on the endpoints. If you add arrowheads to the connector, the snap points occur at the point of the arrowhead:

Connectors have snap points at endpoints and arrowhead points.
Interacting with the snap points
Two objects are automatically snapped together when two of their snap points get close to each other. This happens when you are either moving objects around, or creating new objects. When moving objects, you'll notice that the object appears to jump around slightly as it crosses over other objects. This is snapping in action: each "jump" is an indication that two snap points became close enough together, and the object being moved was adjusted to make the snap.
When you create new objects, you will see small boxes appear whenever your mouse is close to a another object:

When your mouse gets near an object, Vexlio will display small boxes to highlight its snap points.
When you click the mouse with near one of these snap points, the object you are creating such as a line, rectangle, or ellipse, will be snapped to that point. This is better illustrated with an animation:
Snapping in action.
Initially, the small circle is moved to the center of the square, snapping to various rectangle points along the way. Then, when the line connector is drawn, you'll notice the small boxes appear, indicating that the line's points can be snapped to those locations. In this example we also see the connector adding constraints to the object it's being connected to. We'll explore constraints more in a separate article.
Align snapping
Another type of snapping that Vexlio offers is "align" snapping. This feature is extremely helpful for quickly and easily making sure two or more objects are perfectly aligned. Of course, you can always use the alignment buttons on the right side of the Vexlio window, but knowing how to use align snapping will save you a lot of time and mouse clicks.
Align snapping occurs automatically when a snap point on an object becomes horizontally or vertically aligned to a snap point on another object, even if they do not touch. Align snapping occurs when creating or moving objects, or creating paths. The animation below shows align-snapping the smaller rectangle to the centerline of the larger rectangle by dragging it until the guide line appears.
Snapping in action.
The smaller rectangle is then duplicated (by Ctrl-dragging it) and moved to the right. The align snapping guide appears and indicates that as the duplicate is moving, it is staying align-snapped to the centerline of the first rectangle. Finally, a path is created between the two smaller rectangles, using a combination of point and align snapping to ensure it connects the rectangles perfectly.
Align snapping works by looking at the "bounding boxes" of all nearby objects. In the image below, we have a few objects with their bounding boxes shown outlined with a semi-transparent rectangle:

Bounding boxes shown on several objects.

Bounding box shown on text.
You'll notice again that these bounding boxes correspond to an object's geometry, which is not necessarily the same as its visual appearance. For example, the thick ellipse's bounding box lies across its exact center-line, not the visual bounds. Text objects' bounds depend on the specific font being used.
Gap snapping
The third type of snapping Vexlio offers is called "gap snapping." Gap snapping offers an extremely easy way to make sure that multiple objects are spaced exactly evenly. While you can always use the sidebar buttons to distribute space vertically or horizontally between selected objects, gap snapping can help you prototype your diagrams much faster, and with far fewer mouse clicks.
Gap snapping works by looking left, right, above and below the object you are currently dragging with your mouse. If Vexlio detects a repeated gap of some distance between other already-existing objects, it will automatically snap the object you're moving to match that same gap. This is easy to see in the following animation:
Gap snapping in action.
First, the rectangle on the right is dragged out to some desired distance. Then, the circle on the bottom is dragged using align-snapping to stay aligned with the rectangles' bottom edges. As the circle approaches the exact midpoint, Vexlio detects the repeated gap between the three objects, and snaps the circle to that gap. Vexlio displays small diagonal "hatch" marks indicating the gaps that match due to the snap action.
Similarly to align snapping, gap snapping also by looking at the bounding boxes of nearby objects.
Grid snapping
The final type of snapping offered by Vexlio is grid snapping. Grid snapping offers you a way to draw everything according to a fixed grid size. This can be useful for diagrams with lots of repeated elements that you wish to easily constrain to a common size and distance apart. The size of the grid can be configured in Drawing Settings.
Enabling and disabling snapping
While snapping is typically very convenient, sometimes it can get in your way. In that case, it's easy to toggle snapping off, make your adjustments, and then turn it back on again. All types of snapping can be enabled and disabled independently at any time in Drawing Settings.
Check back for more
That's it for this post, we hope it has helped you understand different ways Vexlio offers easy precision and alignment for your diagrams. Check back later for more articles!
Launches in your browser, no sign in required.
Latest Articles from Vexlio
Speed up your Overleaf workflow: fast diagramming with Vexlio
Learn an efficient workflow for creating technical diagrams for your Overleaf content.
Introducing a new look for Vexlio
The new Vexlio is here. Learn more about our next chapter!