diff --git a/examples/try.html b/examples/try.html index 0bc19c3..85a78b5 100644 --- a/examples/try.html +++ b/examples/try.html @@ -19,6 +19,11 @@

Try Seqdiag.js

B -> C [label = "B to C"]; C --> B [label = "C to B"]; B --> A [label = " return to A"]; + A --> A [label = " self transition on A"]; + B --> B [label = " self transition on B"]; + D --> D [label = " self transition on D"]; + C --> C [label = " self transition on C"]; + } diff --git a/lib/seqdiag.js b/lib/seqdiag.js index d6880de..68ae17c 100644 --- a/lib/seqdiag.js +++ b/lib/seqdiag.js @@ -420,12 +420,7 @@ } var nextNodeRect = this.getNodeRect(nextNode.id); var fromX = parseInt(target.getAttribute("x")) + parseInt(target.getAttribute("width")) / 2.0; - var toX = parseInt(nextNodeRect.getAttribute("x")) + parseInt(nextNodeRect.getAttribute("width")) / 2.0; - if ( fromX < toX ) { - toX = fromX + ( toX - fromX ) / 2; - } else { - toX = fromX + ( fromX - toX ) / 2; - } + var toX = fromX + this.svg.width.baseVal.value / nodes.length / 2 var fromPath = this.createSVGElement("path"); fromPath.setAttribute("stroke", this.defaultStrokeColor);