Honesty note: Dia is a free, open-source diagram editor from the GNOME community. This website is an independent community resource — we are not the Dia developers, and this is not the official site. What follows is how Dia’s connection system genuinely works — once you see it, lines stop “randomly” detaching.
You draw a line between two boxes, nudge one box into place, and the line stays behind — or drifts off at a weird angle. It feels random, but it isn’t: in Dia, a line is only glued to a shape when its endpoint is attached to one of the shape’s connection points (the small × marks). If the endpoint is merely sitting on top of the shape, moving the shape leaves the line behind. Here’s how to connect lines properly so they stay attached.
How Dia connections actually work
- Every shape exposes connection points — small × marks, usually at corners, edge midpoints, and other sensible anchor spots.
- When you drag a line’s endpoint onto a connection point, the endpoint handle turns red. Red means connected. Green means it’s just floating near the shape.
- A red (connected) endpoint follows the shape when you move it. A green endpoint stays where you dropped it.
- This single distinction explains nearly every “my lines won’t stick” complaint.
The fix: connect to the × marks, not the shape
- Zoom in (View → Zoom In, or Ctrl+plus). At 100% zoom the × marks are tiny and easy to miss — this is the most common reason people think they connected a line when they didn’t.
- Select the line tool and start drawing your connector.
- Drag one endpoint directly onto a × connection point on the first shape. Watch the endpoint handle: it must turn red. If it stays green, you missed — try again, zoomed in further.
- Drag the other endpoint onto a × on the second shape until it also turns red.
- Test it: select one of the shapes and drag it. Both line ends should follow. If an end stays behind, that end was never truly connected — repeat step 3 for it.
The 5-second test: after connecting, drag each shape a little. If the line stretches and follows, you’re done. Make this test a habit and you’ll never be surprised by a detached line again.
If lines still won’t stay attached
- Check the snapping helpers in the View menu. Dia offers snap-to-grid and snap-to-object aids — with them on, endpoints gravitate toward connection points instead of landing between them. (Snapping affects placement, not the red/green connection state itself.)
- Don’t drop endpoints in empty space between points. On a small shape at low zoom it’s easy to land an endpoint on the shape’s fill rather than a ×. Zoom in and be deliberate.
- Redraw the line instead of repairing it. A line whose endpoints were placed wrong is often faster to delete and redraw correctly than to fiddle with.
- Orthogonal vs. straight lines: if a connector takes a strange route after moving shapes, that’s the line’s routing, not a failed connection — check the endpoint color first before assuming the worst.
- Grouped objects: ungroup (Objects → Ungroup) if you need to connect to a shape inside a group; connection points of grouped shapes can be hard to target precisely.
Pick the right connector tool
Dia’s toolbox offers several line tools, and using the wrong one causes half the frustration:
- Straight line — point-to-point, best for simple annotations and leaders.
- Orthogonal (right-angle) line — the workhorse for flowcharts and network diagrams; it routes in clean horizontal/vertical segments and re-routes sensibly when shapes move.
- Polyline / bezier — for custom paths and curved connectors.
If your connectors look messy after rearranging shapes, try redrawing them with the orthogonal line tool instead of the straight line — right-angle connectors tolerate layout changes far better, and their endpoints obey the same red-means-connected rule.
Building diagrams that survive editing
A few habits make connected diagrams far less fragile:
- Connect every line end to a ×, even for quick sketches — future-you will move those shapes.
- Do the drag-test after each connection while the layout is still simple.
- For flowcharts and ER diagrams, where connectors are the whole point, zoom to 150–200% while wiring things up. Our flowchart tutorial and ER diagram tutorial both use heavily connected layouts, so they’re good practice ground.
Frequently asked questions
Why do my lines disconnect when I move a shape?
Because the endpoint was never attached to a connection point — it was just overlapping the shape. Only a red endpoint handle means a real connection. Re-attach it to a × mark.
What do the red and green handles mean?
Green: the line endpoint is free-floating. Red: the endpoint is connected to a shape’s connection point and will follow the shape. Aim for red on both ends of every connector.
Can I add my own connection points to a shape?
Dia’s built-in shapes have fixed connection points — you can’t add new × marks to them. If a shape lacks a point where you need one, route the line with an extra segment or choose a nearby point; don’t leave the endpoint floating.
Do I need snap-to-grid on for connections to work?
No. Snapping only helps you place endpoints accurately; the connection itself depends on landing the endpoint on a × mark. Many experienced users connect with snapping off, zoomed in close.
Lines connect fine but look crooked after moving shapes — is that normal?
Yes, that’s routing, not detachment. The line stays connected (endpoints red) but re-routes around the new shape positions. Adjust with intermediate segments if the path bothers you.
