Skip to content

Commit

Permalink
Fix a bug with self transition: now self transition takes half of a r…
Browse files Browse the repository at this point in the history
…ow width; In the 'Try Seqdiag.js' example, a self transition on B is not anymore empty.
  • Loading branch information
badock committed Feb 19, 2013
1 parent b3b25c5 commit d24713d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions examples/try.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ <h1>Try Seqdiag.js</h1>
B -&gt; C [label = "B to C"];
C --&gt; B [label = "C to B"];
B --&gt; A [label = " return to A"];
A --&gt; A [label = " self transition on A"];
B --&gt; B [label = " self transition on B"];
D --&gt; D [label = " self transition on D"];
C --&gt; C [label = " self transition on C"];

}
</textarea></div>
<input id="submit-preview" type="submit" value="preview">
Expand Down
7 changes: 1 addition & 6 deletions lib/seqdiag.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d24713d

Please sign in to comment.