-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Self-edges/loops look very awkward in state diagrams #6336
Comments
Hello, I completely agree that self-loops in Mermaid state diagrams currently do not render as cleanly as they do in Graphviz digraphs. The issue appears to stem from how self-loops are treated like standard edges rather than being explicitly optimized for circular positioning. Possible Issues in the Current Implementation1. Lack of Explicit Self-Loop Handling
2. Edge Routing & Layout Constraints
3. Styling & Customization Limitations
Possible Fixes & Enhancements
Would love to hear your thoughts. |
Hello @hjfreyer I have also tested self-loops across multiple diagram types and confirm that the issue affects state diagrams class diagrams and flowcharts, where loops are misaligned, overlapping, or bending unnaturally even when forcing a horizontal layout. However, like you mentioned for graphviz, sequence diagrams also render self-loops correctly, which requires further investigation. Screenshots for Reference:
|
Description
In state diagrams where a state connects to itself, it looks, well... ugly. Like the edge was about to point to a different node, but then realized it was heading in the wrong direction and doubled-back on itself.
Steps to reproduce
Or, in the live editor.
Screenshots
Code Sample
Setup
Suggested Solutions
Compare that to this graphviz digraph:
So much more natural. The salient differences are the fact that the edge is to the side of the node, and that it doesn't have the unfortunate kink in it.
Additional Context
Issue #1443 may be related. It's complaining about rendering of self-edges, but it's less clear to me what the specific complaint is.
The text was updated successfully, but these errors were encountered: